Skip to content

Commit dedb5a0

Browse files
Pass filenames to pre-commit hook
This is an alternative to having the hook run always over all appropriate files, this means: * We can configure `pre-commit` to exclude[1] certain files. This is my main motivation since I'm wanting to use this hook in a repo with a Go file with an intentional syntax error[2] * We only run `golines` over changed files, this could speed things up in repos that have a very large number of Go files The shortopt was also replace with a long one for readability [1] https://pre-commit.com/#top_level-exclude [2] https://gitlab.com/matthewhughes/go-cov/-/blob/81a617e1c8151f6f02f7118de80f1bffd123bfc3/testdata/syntax-error/syntax_error.go#L5
1 parent d7d11e6 commit dedb5a0

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

.pre-commit-hooks.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
- id: golines
22
name: golines
33
description: A golang formatter that fixes long lines.
4-
entry: golines . -w
4+
entry: golines --write-output
55
types: [go]
66
language: golang
7-
pass_filenames: false

0 commit comments

Comments
 (0)