Verify Go formatting with gofumpt, not gofmt, so fmt and check agree #70
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
script/fmt:20writes withgofumpt -l -w mfer internal cmd.script/fmt-checkandscript/lintboth verify with plaingofmt -l ..gofumptis a strict superset ofgofmt, so a file can begofmt-cleanwhile still being rewritten by
gofumpt. The result is thatmake lint,make fmt-check, and thereforemake checkcan all pass green on a treethat
make fmtwould immediately modify. The gate does not check what theformatter enforces.
There is a second, quieter mismatch:
script/fmtformats only themfer internal cmddirectories, while the check commands run over.(everything). The two commands do not even operate on the same file set.
Definition of done
script/fmt-checkandscript/lintverify withgofumpt -l, matchingwhat
script/fmtwrites.script/fmtandscript/fmt-checkoperate on the same file set. Pick one— either both take the explicit directory list or both take
.— and makethem consistent.
make fmtproduces no diff andmake fmt-checkpasses; after deliberately introducing a gofumpt-onlyviolation (one that
gofmtaccepts),make fmt-checkfails andmake fmtfixes it.
mfer/mf.pb.go) are excluded from the check, or verifiedto already satisfy it, so the gate does not fail on code the repo does not
author.
make checkpasses.TODO.mdupdated in the same commit.Implementation requirements
gofumptmust be installed byscript/bootstrap; that is tracked in #68.Until it is,
script/fmt-checkmust fail with a clear "run make bootstrap"message rather than silently passing when
gofumptis absent. A check thatno-ops when its tool is missing is the bug this issue is about.
script/fmtdown togofmtto resolve the mismatch in theother direction.
gofumptis the intended formatter; the checks are whatis wrong.
.golangci.ymlalready enables agofumptformatter pass.If
golangci-lintis already enforcing it, the standalone check may beredundant — say so explicitly in the commit message rather than leaving
two overlapping mechanisms with no comment. Do not modify
.golangci.ymleither way; it is user-owned.
(closes #70).