Make fmt-check check what fmt writes (closes #22) #24

Merged
clawbot merged 1 commits from fmt-check-matches-fmt into next 2026-10-06 10:43:52 +02:00
Collaborator

script/fmt writes with gofmt -s and goimports, but script/fmt-check only ran gofmt -l. A file that gofmt -s would simplify, or whose imports goimports would regroup, passed make check and then changed the next time someone ran make fmt. This fixes #22.

script/fmt-check now runs gofmt -s -l . and goimports -l ., prints the files either would change, and exits non-zero. It writes nothing. Like script/fmt, it puts Go's bin directory on PATH first, so it runs the goimports that script/bootstrap installs. Most formatting slips are reported by both tools, so the list goes through sort -u to print each file once.

make fmt-check (and so make check) now needs goimports on the host, as make fmt already did. make bootstrap installs it, and script/cibuild runs that first.

Judgement call: the README line saying make check checks formatting "with gofmt" now names both formatters. The issue did not ask for that, but the line described the old check.

Model: opus-5-5

`script/fmt` writes with `gofmt -s` and goimports, but `script/fmt-check` only ran `gofmt -l`. A file that `gofmt -s` would simplify, or whose imports goimports would regroup, passed `make check` and then changed the next time someone ran `make fmt`. This fixes https://git.eeqj.de/sneak/attrsum/issues/22. `script/fmt-check` now runs `gofmt -s -l .` and `goimports -l .`, prints the files either would change, and exits non-zero. It writes nothing. Like `script/fmt`, it puts Go's bin directory on `PATH` first, so it runs the goimports that `script/bootstrap` installs. Most formatting slips are reported by both tools, so the list goes through `sort -u` to print each file once. `make fmt-check` (and so `make check`) now needs goimports on the host, as `make fmt` already did. `make bootstrap` installs it, and `script/cibuild` runs that first. Judgement call: the README line saying `make check` checks formatting "with `gofmt`" now names both formatters. The issue did not ask for that, but the line described the old check. Model: opus-5-5
clawbot added the needs-review label 2026-10-06 10:10:02 +02:00
clawbot self-assigned this 2026-10-06 10:10:02 +02:00
clawbot added 1 commit 2026-10-06 10:10:02 +02:00
Make fmt-check check what fmt writes (closes #22)
check / check (push) Successful in 1m52s
80304b6f41
script/fmt writes with gofmt -s and goimports, but script/fmt-check
only ran gofmt -l. A file that gofmt -s would simplify, or whose
imports goimports would regroup, passed make check and then changed
on the next make fmt.

script/fmt-check now runs gofmt -s -l and goimports -l, prints each
file either would change once, and fails. It puts Go's bin directory
on PATH first, as script/fmt does, so it runs the goimports that
script/bootstrap installs. The README line on what make check runs
now names both formatters.

Model: opus-5-5
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit 4666af1cc8 into next 2026-10-06 10:43:52 +02:00
clawbot deleted branch fmt-check-matches-fmt 2026-10-06 10:43:53 +02:00
Sign in to join this conversation.