Check Go formatting with gofumpt, as make fmt writes it (closes #70) #149

Merged
clawbot merged 1 commits from issue-70-gofumpt-check into next 2026-10-04 17:54:52 +02:00
Collaborator

The Go format check ran plain gofmt, which accepts code that gofumpt (what make fmt writes with) rewrites, so make check could pass on a tree make fmt would change. The two also covered different directories.

script/gofumpt --write|--check now runs one pinned gofumpt (v0.12.0) over every Go file, the way script/prettier does for Markdown. script/fmt, script/fmt-check and make fmt-check-go (the Docker lint stage) all call it. The check captures gofumpt's output on its own line, so it fails when gofumpt cannot run instead of passing.

Not visible in the diff:

  • .golangci.yml enables no golangci-lint formatters, so this is the only Go format check, not a duplicate.
  • Generated mfer/mf.pb.go passes: gofumpt applies only gofmt's rules to generated files.
  • No Go file needed reformatting at v0.12.0.

Disclosures:

  • Judgement call: go run mvdan.cc/gofumpt@v0.12.0 instead of a go install line in the Dockerfile, so the version is written once and nothing installs gofumpt.
  • Deviation: script/fmt-check-go is removed; make fmt-check-go calls script/gofumpt --check, as make fmt-check-md calls script/prettier --check.
  • Deviation: no "run make bootstrap" message as the issue asked; gofumpt is never missing, and a failure to fetch or build it fails the check.
  • Pinned by version, checked by the Go checksum database, not by a hash in the repo; hash pinning of developer tools stays with #68.
  • gofumpt v0.12.0 needs Go 1.26; an older local Go downloads it unless GOTOOLCHAIN=local.
  • No test added: the change is to shell scripts.

Closes #70

Model: opus-5-5

The Go format check ran plain `gofmt`, which accepts code that `gofumpt` (what `make fmt` writes with) rewrites, so `make check` could pass on a tree `make fmt` would change. The two also covered different directories. `script/gofumpt --write|--check` now runs one pinned `gofumpt` (v0.12.0) over every Go file, the way `script/prettier` does for Markdown. `script/fmt`, `script/fmt-check` and `make fmt-check-go` (the Docker lint stage) all call it. The check captures gofumpt's output on its own line, so it fails when gofumpt cannot run instead of passing. Not visible in the diff: - `.golangci.yml` enables no golangci-lint formatters, so this is the only Go format check, not a duplicate. - Generated `mfer/mf.pb.go` passes: gofumpt applies only gofmt's rules to generated files. - No Go file needed reformatting at v0.12.0. Disclosures: - Judgement call: `go run mvdan.cc/gofumpt@v0.12.0` instead of a `go install` line in the Dockerfile, so the version is written once and nothing installs gofumpt. - Deviation: `script/fmt-check-go` is removed; `make fmt-check-go` calls `script/gofumpt --check`, as `make fmt-check-md` calls `script/prettier --check`. - Deviation: no "run make bootstrap" message as the issue asked; gofumpt is never missing, and a failure to fetch or build it fails the check. - Pinned by version, checked by the Go checksum database, not by a hash in the repo; hash pinning of developer tools stays with https://git.eeqj.de/sneak/mfer/issues/68. - gofumpt v0.12.0 needs Go 1.26; an older local Go downloads it unless `GOTOOLCHAIN=local`. - No test added: the change is to shell scripts. Closes https://git.eeqj.de/sneak/mfer/issues/70 Model: opus-5-5
clawbot added the needs-review label 2026-10-04 17:24:05 +02:00
clawbot self-assigned this 2026-10-04 17:24:05 +02:00
clawbot added 1 commit 2026-10-04 17:24:05 +02:00
The Go format check ran plain gofmt, which accepts code that gofumpt,
the formatter script/fmt runs, rewrites; and the two covered different
files. Both now go through script/gofumpt, which runs one pinned
gofumpt version over every Go file in --write or --check mode, as
script/prettier does for Markdown. It replaces script/fmt-check-go;
make fmt-check-go and the Docker lint stage call it. go run builds the
pinned version, so nothing has to install gofumpt, and the check fails
when gofumpt cannot run instead of passing. Generated mfer/mf.pb.go
passes: gofumpt holds generated files to gofmt's rules. The check is
not redundant: .golangci.yml enables no golangci-lint formatters.

Model: opus-5-5
Author
Collaborator

Review passed.
Gated on next at 400a2f8.

  • Rule deferred: gofumpt is pinned by version and checked by the Go checksum database, not by a hash in the repo; hash pinning stays with #68.
  • Judgement call: accepted dropping the issue's "run make bootstrap" message, since nothing has to install gofumpt and a failed fetch or run fails the check.
  • Judgement call: make fmt and the check both walk the whole working directory, as the issue allowed, so they also reach untracked Go files below it, such as another checkout nested inside it.

Model: opus-5-5

Review passed. Gated on `next` at `400a2f8`. - Rule deferred: gofumpt is pinned by version and checked by the Go checksum database, not by a hash in the repo; hash pinning stays with https://git.eeqj.de/sneak/mfer/issues/68. - Judgement call: accepted dropping the issue's "run make bootstrap" message, since nothing has to install gofumpt and a failed fetch or run fails the check. - Judgement call: `make fmt` and the check both walk the whole working directory, as the issue allowed, so they also reach untracked Go files below it, such as another checkout nested inside it. Model: opus-5-5
clawbot merged commit acff23d92b into next 2026-10-04 17:54:52 +02:00
clawbot deleted branch issue-70-gofumpt-check 2026-10-04 17:54:52 +02:00
Sign in to join this conversation.