Skip to content

Commit d6d2fcf

Browse files
authored
feat: Remove duplicate pre-commit hooks (#36)
This pre-commit does not need to duplicate what golangci-lint pre-commit already does, and very well! So this repo is going to focus on golang workflow checks. Signed-off-by: Bryan Hundven <[email protected]>
1 parent 92c1451 commit d6d2fcf

File tree

10 files changed

+7
-170
lines changed

10 files changed

+7
-170
lines changed

.github/README.md.header

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
# golang-pre-commit
22

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

.github/workflows/update-readme.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
echo -ne ' - repo: https://github.com/bhundven/golang-pre-commit.git\n' >&3
6262
echo -ne " rev: ${LATEST_VER}\n" >&3
6363
echo -ne ' hooks:\n' >&3
64-
echo -ne ' - id: go-fmt\n' >&3
64+
echo -ne ' - id: go-generate\n' >&3
6565
echo -ne '```\n\n' >&3
6666
6767
echo -ne "## Available Hooks\n\n" >&3

.pre-commit-hooks.yaml

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,4 @@
11
---
2-
- id: go-fmt
3-
name: 'gofmt'
4-
entry: pre-commit-hooks/gofmt.sh
5-
types: [go]
6-
exclude: '(^|/)vendor/'
7-
language: 'script'
8-
description: "Runs `gofmt`. Requires golang: https://go.dev/doc/install"
9-
pass_filenames: true
10-
- id: go-fumpt
11-
name: 'gofumpt'
12-
entry: pre-commit-hooks/go-fumpt.sh
13-
types: [go]
14-
exclude: '(^|/)vendor/'
15-
language: 'script'
16-
description: "Runs `gofumpt`. Requires gofumpt: https://github.com/mvdan/gofumpt"
17-
pass_filenames: true
18-
- id: go-imports
19-
name: 'goimports'
20-
entry: pre-commit-hooks/go-imports.sh
21-
types: [go]
22-
exclude: '(^|/)vendor/'
23-
language: 'script'
24-
description: "Runs `goimports`. Requires goimports: https://pkg.go.dev/golang.org/x/tools/cmd/goimports"
25-
pass_filenames: true
26-
- id: go-vet
27-
name: 'go vet'
28-
entry: pre-commit-hooks/go-vet.sh
29-
types: [go]
30-
exclude: '(^|/)vendor/'
31-
language: 'script'
32-
description: "Runs `go vet`. Requires golang: https://go.dev/doc/install"
33-
pass_filenames: true
34-
- id: go-lint
35-
name: 'golint'
36-
entry: pre-commit-hooks/go-lint.sh
37-
types: [go]
38-
exclude: '(^|/)vendor/'
39-
language: 'script'
40-
description: "[DEPRECATED] Runs `golint`. Requires golint: https://github.com/golang/lint"
41-
pass_filenames: true
42-
- id: golangci-lint
43-
name: 'golangci-lint'
44-
entry: pre-commit-hooks/golangci-lint.sh
45-
types: [go]
46-
exclude: '(^|/)vendor/'
47-
language: 'script'
48-
description: "Runs `golangci-lint`. Requires golangci-lint: https://github.com/golangci/golangci-lint"
49-
pass_filenames: true
50-
- id: go-critic
51-
name: "gocritic"
52-
entry: pre-commit-hooks/go-critic.sh
53-
types: [go]
54-
exclude: '(^|/)vendor/'
55-
language: 'script'
56-
description: "Runs `gocritic`. Requires gocritic: https://github.com/go-critic/go-critic"
57-
pass_filenames: true
582
- id: go-unit-tests
593
name: 'go test'
604
entry: pre-commit-hooks/go-unit-tests.sh

pre-commit-hooks/go-critic.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.

pre-commit-hooks/go-fumpt.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

pre-commit-hooks/go-imports.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

pre-commit-hooks/go-lint.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.

pre-commit-hooks/go-vet.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

pre-commit-hooks/gofmt.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

pre-commit-hooks/golangci-lint.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)