From 1a92cf6f841c1c09cea70e9baeb2ad1ebbf6b368 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Sat, 19 Sep 2026 19:00:47 +1000 Subject: [PATCH] fix(build): make task fmt apply the gofumpt rules task lint checks `task lint` enables gofumpt's `extra-rules`, so it demands `func f(a, b int)` where `task fmt`'s bare `gofumpt -w .` left `func f(a int, b int)` alone -- and `task fmt` is the documented repair for a failing gate, so a contributor had no command that could satisfy `task check`. That is the same failure shape as the version drift fixed alongside it, one layer up: fmt and lint are not the same formatter, so only the rules they happen to share are safe. `-extra` matches `extra-rules`, and nothing reformats as a result: the tree is already clean under it (`gofumpt -extra -l .` is empty). Still open, filed as archie-core-q288: gci's custom-order places archie-core imports last where gofumpt sorts them alphabetically, so `task fmt` can still produce formatting it will never fix. That needs a decision about which formatter owns formatting rather than another flag, and it is a decision CI cannot currently surface at all -- the deploy gate never runs golangci-lint. --- .agents/skills/archie-build-and-env/SKILL.md | 12 +++++++++++- Taskfile.yml | 6 +++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.agents/skills/archie-build-and-env/SKILL.md b/.agents/skills/archie-build-and-env/SKILL.md index 17e5c319d..3ccb07b2c 100644 --- a/.agents/skills/archie-build-and-env/SKILL.md +++ b/.agents/skills/archie-build-and-env/SKILL.md @@ -54,6 +54,16 @@ failure for formatting. Install the pair from `Dockerfile` than `@latest` for either: on a construct the two versions disagree on, `task fmt` cannot converge `task lint`, and the gate is unsatisfiable. +A rule only one side applies fails the same way, so `task fmt` also passes +`-extra` to match the formatter's `extra-rules`. Both mismatches are +reachable in ordinary code: gofumpt <= v0.9.2 keeps the redundant parens in +`any((Trees)(nil))` that >= v0.10.0 removes, and without `-extra` +`func f(a int, b int)` stays put while `task lint` demands `func f(a, b int)`. +Formatting that only `task lint` can produce is still a real gap -- `gci`'s +`custom-order` places archie-core imports last, where gofumpt sorts them +alphabetically -- so run `golangci-lint fmt` when `task fmt` leaves a +formatting failure standing. + | Surface | Repository declaration | Installed snapshot | Interpretation | |---|---|---|---| | Runtime Go | `go 1.27.0` in `go.mod` | Go 1.27.0, linux/amd64 | Requires at least declared Go level. | @@ -113,7 +123,7 @@ golangci-lint run ./... | Task | Exact effect | |---|---| -| `task fmt` | `gofumpt -w .`, then `go fix ./...` — both may rewrite source. | +| `task fmt` | `gofumpt -extra -w .`, then `go fix ./...` — both may rewrite source. | | `task vet` | `go vet ./...` in the runtime module. | | `task lint` | `golangci-lint run ./...`. | | `task build` | Builds both commands into `bin/`. | diff --git a/Taskfile.yml b/Taskfile.yml index 1fb93c58f..c68e04160 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -12,7 +12,11 @@ tasks: fmt: desc: Format and fix Go source (gofumpt, go fix) cmds: - - gofumpt -w . + # -extra must match the gofumpt formatter's extra-rules in + # .golangci.yml. Without it `task fmt` cannot produce what `task lint` + # demands -- e.g. func f(a int, b int) -> func f(a, b int) -- so a + # contributor has no command that satisfies the gate. + - gofumpt -extra -w . - go fix ./... proto:install: