:rotating_light: Please see the project sunsetting announcement: Issues/98 :rotating_light:
golang hooks for http://pre-commit.com/
Add this to your .pre-commit-config.yaml
- repo: https://github.com/dnephin/pre-commit-golang
rev: master
hooks:
- id: go-fmt
- id: go-vet
- id: go-lint
- id: go-imports
- id: go-cyclo
args: [-over=15]
- id: validate-toml
- id: no-go-testing
- id: golangci-lint
- id: go-critic
- id: go-unit-tests
- id: go-build
- id: go-mod-tidy
go-fmt
- Runs gofmt
, requires golanggo-vet
- Runs go vet
, requires golanggo-lint
- Runs golint
, requires https://github.com/golang/lint but is unmaintained & deprecated in favour of golangci-lint
go-imports
- Runs goimports
, requires golang.org/x/tools/cmd/goimportsgo-cyclo
- Runs gocyclo
, require https://github.com/fzipp/gocyclovalidate-toml
- Runs tomlv
, requires
https://github.com/BurntSushi/toml/tree/master/cmd/tomlvno-go-testing
- Checks that no files are using testing.T
, if you want
developers to use a different testing frameworkgolangci-lint
- run golangci-lint run ./...
, requires
golangci-lintgo-critic
- run gocritic check ./...
, requires go-criticgo-unit-tests
- run go test -tags=unit -timeout 30s -short -v
go-build
- run go build
, requires golanggo-mod-tidy
- run go mod tidy -v
, requires golanggo-mod-vendor
- run go mod vendor
, requires golang