-
Notifications
You must be signed in to change notification settings - Fork 0
Guidelines for Go
Each repository can maintain its own version of the Go toolchain. Whatever is specified in the root go.mod
file is considered canonical for that repository.
Go code should be formatted via gofumpt, a slightly more opinionated variant of gofmt
. This can be automated for pre-commit hooks via golangci-lint.
Linting should be handled via golangci-lint.
The list of linters that should be enabled is being compiled.
Testing should be performed by the built in go test
command. -race
detection should be utilized and code coverage via -covermode=atomic
.
Reporting via codecov.io with a badge on the README.md
is recommended.
Go services should be packaged via Docker utilizing multi-stage builds and distroless containers.
Documenting go code should follow standard godoc conventions.
Continuous Integration is performed with GitHub Actions.
CI should:
- Ensure code builds cleanly
- All unit tests pass
- All integration tests pass
- Check for race conditions
- Lint cleanly
- Code is formatted correctly
- All generated files are up to date