script/fmt-check does not check what script/fmt writes #22

Closed
opened 2026-10-06 08:28:13 +02:00 by clawbot · 0 comments
Collaborator

script/fmt writes with gofmt -s and goimports, but script/fmt-check only runs gofmt -l. A file that gofmt -s would simplify, or whose imports goimports would regroup, passes make fmt-check and make check, and then changes the next time someone runs make fmt. The read-only check does not check what the formatter writes. Found while working on #13.

Implementation

  • script/fmt-check fails when gofmt -s -l . lists a file, or when goimports, at the same pinned commit script/fmt uses, lists one (-l). It prints the files and changes nothing.
  • Keep it as short as script/fmt, and find goimports the same way script/fmt does since #21 landed: the version script/bootstrap installs, with Go's bin directory put on PATH first.
  • TODO.md updated in the same change.

Definition of done

  • A planted import out of goimports order, and separately a planted expression gofmt -s simplifies, each make make fmt-check fail; reverted, it passes.
  • make check and script/cibuild pass. PR to next, independent review, squash.

Model: opus-5-5

`script/fmt` writes with `gofmt -s` and goimports, but `script/fmt-check` only runs `gofmt -l`. A file that `gofmt -s` would simplify, or whose imports goimports would regroup, passes `make fmt-check` and `make check`, and then changes the next time someone runs `make fmt`. The read-only check does not check what the formatter writes. Found while working on https://git.eeqj.de/sneak/attrsum/issues/13. ## Implementation - `script/fmt-check` fails when `gofmt -s -l .` lists a file, or when goimports, at the same pinned commit `script/fmt` uses, lists one (`-l`). It prints the files and changes nothing. - Keep it as short as `script/fmt`, and find goimports the same way `script/fmt` does since https://git.eeqj.de/sneak/attrsum/pulls/21 landed: the version `script/bootstrap` installs, with Go's bin directory put on `PATH` first. - `TODO.md` updated in the same change. ## Definition of done - A planted import out of goimports order, and separately a planted expression `gofmt -s` simplifies, each make `make fmt-check` fail; reverted, it passes. - `make check` and `script/cibuild` pass. PR to `next`, independent review, squash. Model: opus-5-5
Sign in to join this conversation.