# README
go-cmd-example
Golang CLI implementation example
Development
- Generate a command template.
$ go get -u github.com/spf13/cobra/cobra $ cobra init --pkg-name github.com/wdstar/go-cmd-example $ go mod tidy $ go build $ ./go-cmd-example
- Add sub commands
$ cobra add version -p "rootCmd" $ go build $ ./go-cmd-example version
- Add goreleaser configurations.
$ curl -sL -o /usr/local/bin/goreleaser https://git.io/goreleaser $ chmod 755 /usr/local/bin/goreleaser $ goreleaser init # Snapshot build $ goreleaser --snapshot --skip-publish --rm-dist $ ./dist/go-cmd-example_linux_amd64/go-cmd-example version # Production release $ export GITHUB_TOKEN=********************************** $ git tag -a vX.X.X -m 'initial release.' $ git push --tags $ goreleaser --rm-dist
# Packages
Package cmd contains CLI implementations.