golang-cli-template
An opinionated template for new Golang cli projects.
Template
This golang CLI template includes the base of a cobra cli tested with testify and codecov. The release process with goreleaser and contains a basic secured Docker image.
The whole thing is documented with MkDocs and templated with go-archetype.
For more information please have a look at the features section of the documentation.
Getting started
Please find all the required information on the getting stared section of the documentation.
Greetings on Pull Requests and Issues
This repository includes greetings on Pull Requests and Issues. By default the comment will be added by the github-actions bot
. If you want to customize it, add a TAP_GITHUB_TOKEN
secret containing a personal access token of the user or organization you want the comment from.
Logo
The logo is based on the create-go-app
. Please find all information here.
Install
You can install the pre-compiled binary (in several ways), use Docker or compile from source (when on OSS).
Below you can find the steps for each of them.
homebrew tap
brew install thazelart/tap/golang-cli-template
apt
echo 'deb [trusted=yes] https://apt.fury.io/thazelart/ /' | sudo tee /etc/apt/sources.list.d/thazelart.list
sudo apt update
sudo apt install golang-cli-template
yum
echo '[thazelart]
name=Gemfury thazelart repository
baseurl=https://yum.fury.io/thazelart/
enabled=1
gpgcheck=0' | sudo tee /etc/yum.repos.d/thazelart.repo
sudo yum install goreleaser
deb, rpm and apk packages
Download the .deb, .rpm or .apk packages from the [release page](https://github.com/thazelart/golang-cli-template/releases) and install them with the appropriate tools.
go install
go install github.com/thazelart/golang-cli-template@latest
from the GitHub releases
Download the pre-compiled binaries from the release page page and copy them to the desired location.
$ VERSION=v1.0.0
$ OS=Linux
$ ARCH=x86_64
$ TAR_FILE=golang-cli-template_${OS}_${ARCH}.tar.gz
$ wget https://github.com/thazelart/golang-cli-template/releases/download/${VERSION}/${TAR_FILE}
$ sudo tar xvf ${TAR_FILE} golang-cli-template -C /usr/local/bin
$ rm -f ${TAR_FILE}
manually
$ git clone github.com/thazelart/golang-cli-template
$ cd golang-cli-template
$ go generate ./...
$ go install
Contribute to this repository
This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. We appreciate your contribution. Please refer to our contributing guidelines for further information.