Pre-commit hooks for Golang
This repository was inspired by dnephin/pre-commit-golang which was not being maintained.
Most hooks were being centralized into golangci-lint
and therefore this repository does not contain all the hooks from the source repository.
These pre-commit hooks require golangci-lint
and golang
To use these hooks, add a .pre-commit-config.yaml
to your repository:
repos:
- repo: git://github.com/bellese/pre-commit-golang
rev: master
hooks:
- id: go-mod-tidy
- id: golangci-lint
go-mod-tidy
- rungo mod tidy -v
, requires golanggolangci-lint
- rungolangci-lint run
, requiresgolangci-lint
- Can be configured via
args
documented here:golangci-lint
Configuration. See the Examples directory for an example configuration.
- Can be configured via