From d2c18ad5bb314e2e82c09b8dbfea52bc0321f594 Mon Sep 17 00:00:00 2001 From: Steve Dudenhoeffer Date: Fri, 26 Jun 2026 19:20:47 -0400 Subject: [PATCH] ci: make tidy-clean check robust to a missing go.sum P0 has no external deps, so go.sum doesn't exist yet and `git diff --exit-code go.mod go.sum` errored (exit 128) on the missing path. Use `git status --porcelain` so the check survives a not-yet-created go.sum and still catches an untidy go.mod or a newly-created go.sum. Co-Authored-By: Claude Opus 4.8 (1M context) --- .gitea/workflows/ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 6179aa2..2dfd963 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -66,7 +66,14 @@ jobs: - name: go mod tidy is clean run: | go mod tidy - git diff --exit-code go.mod go.sum + # go.sum may not exist yet (no external deps), so don't name it as a + # diff path (git errors on a missing path). git status flags both a + # modified go.mod and a freshly-created untracked go.sum. + CHANGES=$(git status --porcelain -- go.mod go.sum) + if [ -n "$CHANGES" ]; then + echo "go.mod/go.sum not tidy:"; echo "$CHANGES"; git diff -- go.mod; exit 1 + fi + echo "OK: go.mod/go.sum tidy." - name: Core stays majordomo+stdlib only run: |