This is a GitHub repository template for Go. It has been created for ease-of-use for anyone who wants to build binaries, Docker images, and publish Github releases.
It includes:
- build automation via Make,
- dependency management using Go Modules,
- linting with golangci-lint,
- unit testing with testify, race detector, code covarage HTML report using go-acc for accurate reporting,
- releasing using GoReleaser,
- dependencies scanning and updating thanks to Dependabot,
- Visual Studio Code configuration with Go and Remote Container support.
This work is based on the upstream Go Repository Template.
- Click the
Use this template
button (alt. clone or download this repository). - Replace all occurences of
jimmidyson/golang-repository-template
toyour_org/repo_name
in all files. - Rename folder
cmd/seed
tocmd/app_name
and update .goreleaser.yml accordingly. - Update LICENSE and README.md.
- Terminal:
make
to get help for make targets. - Visual Studio Code:
Terminal
→Run Build Task... (CTRL+SHIFT+B)
to execute a fast build.
CAUTION: Make sure to understand the consequences before you bump the major version. More info: Go Wiki, Go Blog.
Remember to update Go version in devcontainer.json.
Notable files:
- devcontainer.json - Visual Studio Code Remote Container configuration,
- .github/dependabot.yml - Dependabot configuration,
- .vscode - Visual Studio Code configuration files,
- .golangci.yml - golangci-lint configuration,
- .goreleaser.yml - GoReleaser configuration,
- Makefile - Make targets used for development, and .vscode/tasks.json,
- go.mod - Go module definition,
- tools.go - build tools.
Developers that use Visual Studio Code can take advantage of the editor configuration. While others do not have to care about it. Setting configs for each repo is unnecessary time consuming. VS Code is the most popular Go editor (survey) and it is officially supported by the Go team.
You can always remove the .devcontainer and .vscode directories if it really does not help you.
Take a look at GoReleaser docs as well as its repo how it is dogfooding its functionality.
You can change the .goreleaser.yml to contain:
build:
skip: true
release:
github:
prerelease: auto
Alternatively, you can completly remove the usage of GoReleaser if you prefer handcrafted release notes.
Simply create an issue or a pull request.