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.
This commit is contained in:
2 files changed
+16
-2
No files matched your search
@@ -54,6 +54,16 @@ failure for formatting. Install the pair from `Dockerfile`
|
|||||||
than `@latest` for either: on a construct the two versions disagree on,
|
than `@latest` for either: on a construct the two versions disagree on,
|
||||||
`task fmt` cannot converge `task lint`, and the gate is unsatisfiable.
|
`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 |
|
| 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. |
|
| 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 | 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 vet` | `go vet ./...` in the runtime module. |
|
||||||
| `task lint` | `golangci-lint run ./...`. |
|
| `task lint` | `golangci-lint run ./...`. |
|
||||||
| `task build` | Builds both commands into `bin/`. |
|
| `task build` | Builds both commands into `bin/`. |
|
||||||
|
|||||||
+5
-1
@@ -12,7 +12,11 @@ tasks:
|
|||||||
fmt:
|
fmt:
|
||||||
desc: Format and fix Go source (gofumpt, go fix)
|
desc: Format and fix Go source (gofumpt, go fix)
|
||||||
cmds:
|
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 ./...
|
- go fix ./...
|
||||||
|
|
||||||
proto:install:
|
proto:install:
|
||||||
|
|||||||
Reference in new issue
Block a user