From a3132792ea4bc2d2712aba168e16328d2e782aa5 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Sat, 21 Nov 2026 14:53:45 +1100 Subject: [PATCH] build(wt:check): apply go fix and the formatters before checking --- Taskfile.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Taskfile.yml b/Taskfile.yml index 0f83fe275..aae5dbbc4 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -364,7 +364,7 @@ tasks: - task: check:readonly wt:check: - desc: "Check a worktree's Go packages and the dashboard if ui/ changed (-- ./pkg/... to name packages; default: those changed since main)" + desc: "Fix, format and check a worktree's Go packages, and the dashboard if ui/ changed (-- ./pkg/... to name packages; default: those changed since main)" # A worktree has no ui/dist, so the Go steps build with no_ui. The full # gate still runs once, on the merged tree. cmds: @@ -378,6 +378,21 @@ tasks: fi if [ -n "$pkgs" ]; then echo "packages: $pkgs" + # The same fixes and formatters as task fmt, applied to these + # packages only; see fmt for why go fix runs until it converges. + converged=false + for pass in 1 2 3 4 5 6 7 8 9 10; do + go fix -tags no_ui $pkgs + if go fix -tags no_ui -diff $pkgs >/dev/null; then + converged=true + break + fi + done + if [ "$converged" != true ]; then + echo "go fix still rewrites these packages after 10 passes" >&2 + exit 1 + fi + golangci-lint fmt $pkgs go vet -tags no_ui $pkgs go test -short -tags no_ui $pkgs golangci-lint run --build-tags no_ui $pkgs