git-pre-commit-hook/README.md

23 lines
583 B
Markdown
Raw Normal View History

2020-02-16 09:46:26 +00:00
# Git pre-commit hook
This commit hook only runs if it detects a Go source repository (by testing for
the presence of a `go.mod` within the first 3 levels of directory).
Tests:
- runs `go vet` on each module
- runs `goimports` on all source (excluding generating protobuf `.pb.go` files)
- checks for large (>1MiB) files
2020-02-16 09:49:55 +00:00
## Installation
You can install this commit globally by adding the following to your
`~/.gitconfig`:
```
[core]
hookspath = /home/username/git/hooks
```
and then copying the executable, named as `pre-commit`, to the directory you
named in `hookspath`.