Skip to content

Commit 28ef4a1

Browse files
authored
Pass only Git-tracked Go files to gofumpt (#4809)
## **PR Description** The below error message is shown when executing `make format` when `test/_results/demo/worktree_create_from_branches/actual/repo/src/shims.go` exists (maybe executing integration test produces this file?). ```sh $ make format gofumpt -l -w . test/_results/demo/worktree_create_from_branches/actual/repo/src/shims.go:1:20: expected 'package', found 'EOF' make: *** [format] Error 2 ``` I have confirmed it works without above error when I run `make format` on this PR's branch.
2 parents b1382da + e9cc07d commit 28ef4a1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ 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.
3739
.PHONY: format
3840
format:
39-
gofumpt -l -w .
41+
git ls-files '*.go' ':!vendor' | xargs gofumpt -l -w
4042

4143
.PHONY: lint
4244
lint:

0 commit comments

Comments
 (0)