๐ Based off of the now-sunsetted repo from @dnephin. Repo here ๐
Run make init-pre-commit
from the backend repo root.
Add this to your .pre-commit-config.yaml
- repo: https://github.com/pokt-foundation/backend-precommit-hooks
rev: v0.0.2 [UPDATE THE VERSION AS NEEDED]
hooks:
- id: go-fmt
- id: go-imports
- id: golangci-lint
- id: go-critic
- id: go-build
- id: go-mod-tidy
- id: go-unit-tests
go-fmt
- Runsgofmt
, requires golanggo-vet
- Runsgo vet
, requires golanggo-imports
- Runsgoimports
, requires golang.org/x/tools/cmd/goimportsgolangci-lint
- rungolangci-lint run ./...
, requires golangci-lintgo-critic
- rungocritic check ./...
, requires go-criticgo-unit-tests
- runCGO_ENABLED=0 go test ./...
go-all-tests
- runmake test
go-build
- rungo build
, requires golanggo-mod-tidy
- rungo mod tidy -v
, requires golang