fix(build): restore the go fix fixpoint, and give the formatter one owner

A "reduce Taskfile bloat" refactor (2e00777f) removed the fixpoint loop from
task fmt and deleted the guard test that proved it, putting the tree back to a
single go fix pass with nothing left to notice. One pass is not a fixpoint:
stditerators rewrites `for i := range t.NumFields()` into a field iterator that
copies its loop variable, and forvar only deletes that copy on the following
pass, leaving a tree copyloopvar rejects. archie-core-wwho regressed silently.

Restore the loop and the guard. The deploy workflow has always inlined its own
single `go fix ./...`, which is how the same hazard reached CI as a spurious
git-diff failure rather than a lint error (archie-core-6kda); it now calls task
fmt, the one owner of the formatter sequence, and its guard rejects an inline
copy so the split cannot come back.
This commit is contained in:
sam committed 2026-10-03 02:28:33 +10:00
1 parent a95062c9ac
commit ba37e37e53
4 files changed
+73 -6

No files matched your search

+16 -1
View File
@@ -85,7 +85,7 @@ func TestDeployWorkflowUsesConfiguredFormatters(t *testing.T) {
source := readDeploymentFile(t, ".github/workflows/deploy.yml")
for _, required := range []string{
"github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.13.2",
"golangci-lint fmt",
"task fmt",
"git diff --exit-code",
"golangci-lint run ./...",
} {
@@ -93,6 +93,21 @@ func TestDeployWorkflowUsesConfiguredFormatters(t *testing.T) {
t.Errorf("deploy workflow is missing formatter gate %q", required)
}
}
// task fmt is the one owner of the formatter sequence, and it drives go fix to
// a fixpoint. An inline single pass here leaves the redundant loop-variable
// copy that copyloopvar rejects -- the hazard of archie-core-wwho, which
// surfaces in this workflow as a spurious git-diff failure rather than a lint
// error (archie-core-6kda). A comment may name the command while explaining
// why it is absent; only a line that is itself a command inlines it.
for line := range strings.SplitSeq(source, "\n") {
trimmed := strings.TrimSpace(line)
if strings.HasPrefix(trimmed, "#") {
continue
}
if strings.HasPrefix(trimmed, "go fix") || trimmed == "golangci-lint fmt" {
t.Errorf("deploy workflow runs %q inline; task fmt owns the formatter sequence", trimmed)
}
}
if strings.Contains(source, "gofumpt -w .") {
t.Error("deploy workflow bypasses the configured formatter set")
}