Simple, opinionated pre-commit hooks for Go projects.
This will automatically run go fmt, go test and go vet on your commits.
You need Go and pre-commit installed on your system.
Add this repository to the repos in your .pre-commit-config.yaml:
repos:
- repo: https://github.com/publysher/golang-pre-commit
rev: v1.0.0
hooks:
- id: go-fmt
- id: go-test
- id: go-vetDon't forget to run pre-commit install if you didn't use pre-commit before.
go-fmtrunsgo fmton all changed Go filesgo-testruns your entire test suite using the-shortflag. It will not fail if there are no tests.go-vetrunsgo veton your entire project
There is no configuration. It's opinionated.