golang hooks for http://pre-commit.com/, golang 1.11+
and go.mod
only
Add this to your .pre-commit-config.yaml
- repo: git://github.com/kreuzwerker/pre-commit-golang
rev: master
hooks:
- id: no-go-testing
- id: golangci-lint
- id: go-unit-tests
- id: go-build
- id: go-mod-tidy
no-go-testing
- Checks that no files are usingtesting.T
, if you want developers to use a different testing frameworkgolangci-lint
- rungolangci-lint run ./...
, requires golangci-lint installed and executable in thebin
directory of the projectgo-unit-tests
- rungo test -tags=unit -timeout 30s -short -v
go-build
- rungo build
, requires golanggo-mod-tidy
- rungo mod tidy -v
, requires golanggo-mod-vendor
- rungo mod vendor
, requires golang