build(wt:check): apply go fix and the formatters before checking
This commit is contained in:
1 file changed
+16
-1
+16
-1
@@ -364,7 +364,7 @@ tasks:
|
|||||||
- task: check:readonly
|
- task: check:readonly
|
||||||
|
|
||||||
wt:check:
|
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
|
# A worktree has no ui/dist, so the Go steps build with no_ui. The full
|
||||||
# gate still runs once, on the merged tree.
|
# gate still runs once, on the merged tree.
|
||||||
cmds:
|
cmds:
|
||||||
@@ -378,6 +378,21 @@ tasks:
|
|||||||
fi
|
fi
|
||||||
if [ -n "$pkgs" ]; then
|
if [ -n "$pkgs" ]; then
|
||||||
echo "packages: $pkgs"
|
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 vet -tags no_ui $pkgs
|
||||||
go test -short -tags no_ui $pkgs
|
go test -short -tags no_ui $pkgs
|
||||||
golangci-lint run --build-tags no_ui $pkgs
|
golangci-lint run --build-tags no_ui $pkgs
|
||||||
|
|||||||
Reference in new issue
Block a user