Skip to content

Commit 0bd65ae

Browse files
committed
Use ignore directive to ignore test files not to be formatted
We have adopted the workaround passing a result of `git ls-files '*.go' ':!vendor'` to gofumpt in jesseduffield#4809. Currently, gofumpt suports `ignore` directive. So we can use it without any workarounds.
1 parent 30169bd commit 0bd65ae

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@ test: unit-test integration-test-all
3434
generate:
3535
go generate ./...
3636

37-
# If you execute `gofumpt -l -w .`, it will format all Go files in the current directory, including `test/_results/*` files.
38-
# We pass only Git-tracked Go files to gofumpt because we don't want to format the test results or get errors from it.
3937
.PHONY: format
4038
format:
41-
git ls-files '*.go' ':!vendor' | xargs gofumpt -l -w
39+
go run mvdan.cc/gofumpt@v0.9.1 -l -w .
4240

4341
.PHONY: lint
4442
lint:

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ module github.com/jesseduffield/lazygit
22

33
go 1.25.0
44

5+
// This is necessary to ignore test files when executing gofumpt.
6+
ignore ./test
7+
58
require (
69
dario.cat/mergo v1.0.1
710
github.com/adrg/xdg v0.4.0

0 commit comments

Comments
 (0)