My Golang Project Update
This is a recap of my new and updated golang projects
Go-MyGit
This is a replacement for my mygit, which I wanted to do it for a long time. Though bash is more than capable for the job, using golang made the process 10x more enjoyable. Using cobra
and 2 of my own libraries allow a very structure code and command line layout.
Right now it support the following features:
- Configuration File
- remotes
- groups
- secrets
- Selector for git servers
- -g/–group
- -r/–remote
- Base(git) Commands
- init
- push
- remote
- add
- list
- remove
- repository(api)
- list all repo on server
- create repo on server
- get/set
- description
- private
- public key(get only)
- secret
- topic
- visibility
- delete
- repository
- secret
All repo and base commands support processing multiple repos/dirs, with the exception of description
and topic
.
A minor drawback is the 11M binary size vs 15k for mygit. 🤦
Github: https://github.com/J-Siu/go-mygit
Releases: https://github.com/J-Siu/go-mygit/releases
Go-Crypto
This is a baby project to do NACL box seal anonymous from command line.
I created this for my final version of bash mygit
to set github action secret.
Github: https://github.com/J-Siu/go-crypto
Releases: https://github.com/J-Siu/go-crypto/releases
Go-GitApi
This is the actual api library of go-mygit. It was a fun project to do and the final product support middleware
behavior, which bring back memory from javascript.
Example:
|
|
Can be written as follow:
|
|
Of course this is not good coding style, especially golang doesn’t support the dot notation like javascript does. Following is how javascript format will look like:
|
|
Github: https://github.com/J-Siu/go-gitapi
Go-Helper
This package expand a lot due to go-gitapi
and go-mygit
. It grow from a single file for go-png2ico to 8 like following:
File | Description |
---|---|
common.go | Debug flag |
crypto.go | Crypto function |
debug.go | Debug functions |
file.go | File/directory functions |
gitCmd.go | Git functions |
myCmd.go | exec.Command shell wrapper |
report.go | report/log functions auto detect and apply json marshal indent |
string.go | string/array functions |
It really save me tones of time, especially report.go
, when dealing with output in go-mygit
.