build(wt:check): apply go fix and the formatters before checking

This commit is contained in:
sam committed 2026-11-21 14:53:45 +11:00
1 parent 7b6154e7e8
commit a3132792ea
1 file changed
+16 -1
+16 -1
View File
@@ -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