This is a collection of golang pre-commit hooks specifcally for build, generate, unit tests, and other build-time workflow checks.
If you need a pre-commit for a linter or formatter, check out the official golangci-lint pre-commit: https://github.com/golangci/golangci-lint/blob/main/.pre-commit-hooks.yaml
- repo: https://github.com/bhundven/golang-pre-commit.git
rev: v1
hooks:
- id: go-generate
go-unit-tests
- Runsgo test
. Requires golang: https://go.dev/doc/installgo-build
- Runsgo build
. Requires golang: https://go.dev/doc/installgo-generate
- Runsgo generate
. Requires golang: https://go.dev/doc/installgo-mod-tidy
- Runsgo mod tidy -v
. Requires golang: https://go.dev/doc/installgo-mod-vendor
- Runsgo mod vendor
. Requires golang: https://go.dev/doc/install