This is a GitHub repository template for Go. It has been created for ease-of-use for anyone who wants to:
- quickly get into Go without losing too much time on environment setup,
- create a new repoisitory with basic Continous Integration.
It includes:
- Visual Studio Code configuration with Go and Remote Container support,
- dependency management using Go Modules,
- linting with golangci-lint,
- build automation via Make, Docker, GitHub Actions,
- releasing using GoReleaser.
Star
this repository if you find it valuable and worth maintaining.
Watch
this repository to get notified about new releases, issues, etc.
- Click the
Use this template
button (alt. clone or download this repository). - Replace all occurences of
golang-templates/seed
toyour_org/repo_name
in all files. - Change LICENSE and README.md.
- Terminal:
make
to get help for make targets. - Terminal:
make all
to execute a full build. - Visual Studio Code:
Terminal
→Run Build Task... (CTRL+ALT+B)
to execute a fast build.
Remember to update Go version in .github/workflows, Makefile and devcontainer.json.
Notable files:
- devcontainer.json - Visual Studio Code Remote Container configuration
- .github/workflows - GitHub Actions workflows
- .vscode - Visual Studio Code configuration files
- .golangci.yml - golangci-lint configuration
- .goreleaser.yml - GoReleaser configuration
- install.sh - build tools installation script
- Makefile - Make targets used for development, CI build and .vscode/tasks.json
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 .vscode directory and update .gitignore if it really does not help you.
The maintainer does not use GoLand. Fell free to create a pull request for #2.
GitHub Actions is out-of-the-box if you are already using GitHub.
However, changing to any other CI server should be very simple, because this repository has build logic and tooling installation in Makefile. You can also use the docker
make target to run the build inside a docker container.
Use WSL (Windows Subsystem for Linux) or try Make Windows port.
Simply create an issue or a pull request.