|
1 | 1 | # golang-pre-commit
|
2 | 2 |
|
3 |
| -This is a collection of golang [pre-commit](http://pre-commit.com/) hooks. |
| 3 | +This is a collection of golang [pre-commit](http://pre-commit.com/) hooks |
| 4 | +specifcally for build, generate, unit tests, and other build-time workflow |
| 5 | +checks. |
| 6 | + |
| 7 | +If you need a pre-commit for a linter or formatter, check out the official |
| 8 | +[golangci-lint](https://golangci-lint.run/) pre-commit: https://github.com/golangci/golangci-lint/blob/main/.pre-commit-hooks.yaml |
4 | 9 | ## Usage
|
5 | 10 |
|
6 | 11 | ```yaml
|
7 | 12 | - repo: https://github.com/bhundven/golang-pre-commit.git
|
8 | 13 | rev: v1
|
9 | 14 | hooks:
|
10 |
| - - id: go-fmt |
| 15 | + - id: go-generate |
11 | 16 | ```
|
12 | 17 |
|
13 | 18 | ## Available Hooks
|
14 | 19 |
|
15 |
| -* `go-fmt` - Runs `gofmt`. Requires golang: https://go.dev/doc/install |
16 |
| -* `go-fumpt` - Runs `gofumpt`. Requires gofumpt: https://github.com/mvdan/gofumpt |
17 |
| -* `go-imports` - Runs `goimports`. Requires goimports: https://pkg.go.dev/golang.org/x/tools/cmd/goimports |
18 |
| -* `go-vet` - Runs `go vet`. Requires golang: https://go.dev/doc/install |
19 |
| -* `go-lint` - [DEPRECATED] Runs `golint`. Requires golint: https://github.com/golang/lint |
20 |
| -* `golangci-lint` - Runs `golangci-lint`. Requires golangci-lint: https://github.com/golangci/golangci-lint |
21 |
| -* `go-critic` - Runs `gocritic`. Requires gocritic: https://github.com/go-critic/go-critic |
22 | 20 | * `go-unit-tests` - Runs `go test`. Requires golang: https://go.dev/doc/install
|
23 | 21 | * `go-build` - Runs `go build`. Requires golang: https://go.dev/doc/install
|
24 | 22 | * `go-generate` - Runs `go generate`. Requires golang: https://go.dev/doc/install
|
25 | 23 | * `go-mod-tidy` - Runs `go mod tidy -v`. Requires golang: https://go.dev/doc/install
|
26 | 24 | * `go-mod-vendor` - Runs `go mod vendor`. Requires golang: https://go.dev/doc/install
|
| 25 | +`go-build` - Runs `go build`. Requires golang: https://go.dev/doc/install |
| 26 | +* `go-generate` - Runs `go generate`. Requires golang: https://go.dev/doc/install |
| 27 | +* `go-mod-tidy` - Runs `go mod tidy -v`. Requires golang: https://go.dev/doc/install |
| 28 | +* `go-mod-vendor` - Runs `go mod vendor`. Requires golang: https://go.dev/doc/install |
27 | 29 | all
|
0 commit comments