gofumpt -l / -d reports unformatted files in CI
gofumpt is a stricter superset of gofmt. gofumpt -l lists files that do not match its stricter rules, and a CI gate fails when that list is non-empty, even for code that gofmt accepts.
What this error means
A gofumpt step lists files and exits non-zero, sometimes flagging code that already passed gofmt (extra blank-line, grouping, and statement rules).
gofumpt
$ test -z "$(gofumpt -l .)"
cmd/app/main.go
Error: Process completed with exit code 1.Common causes
gofumpt enforces rules gofmt does not
gofumpt adds formatting rules on top of gofmt, so passing gofmt is not enough to pass gofumpt.
Files were formatted with gofmt only
Code run through gofmt (but not gofumpt) still differs from gofumpt's stricter output.
How to fix it
Run gofumpt -w and commit
- Install gofumpt and run
gofumpt -w .. - Commit the changes.
- Re-run
gofumpt -l .and confirm it is empty.
Terminal
go install mvdan.cc/gofumpt@latest
gofumpt -w .
gofumpt -l . # expect emptyUse gofumpt consistently or enable it in golangci-lint
Pick gofumpt everywhere (editor + CI) or enable the gofumpt linter in golangci-lint so local and CI agree.
How to prevent it
- Use gofumpt for format-on-save if CI uses gofumpt.
- Pin the gofumpt version to avoid rule drift.
- Enable the gofumpt formatter in golangci-lint for one source of truth.
Related guides
gofmt -l lists unformatted files and fails CIFix a gofmt formatting gate in CI - `gofmt -l` prints any file that is not gofmt-formatted, and the CI check…
golangci-lint "File is not `gofmt`-ed with `-s`" in CIFix golangci-lint gofmt linter "File is not `gofmt`-ed with `-s`" in CI - source was committed without gofmt…
ruff format --check "would reformat" in CIFix ruff "format --check" failing in CI - ruff lists "Would reformat: <file>" and exits 1 when files are not…