make deps: repair a module cache whose rastrillo extraction lost files
CI failed vet at 841a6a6 with "pattern locales/*.toml: no matching files found" (and migrations/*.sql, ui/calendar.js) inside the runner's cached amadan.net/rastrillo/rastrillo 29e4491, while the same commit passed here. Calendar's branch met the same runner cache first (oficina/calendar#26), where go mod verify there reported a dozen modules as modified. main only compiled rastrillo's crypto and assertion packages, which embed nothing, so it never noticed. vet now depends on deps: go mod download, then go mod verify; a module it reports as "dir has been modified" is deleted and extracted again from the checksummed zip. The same target, reproduced with a scratch GOMODCACHE, repaired Calendar's CI.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+20
−2
Makefile+20 −2
CI passed — run details
diff --git a/Makefile b/Makefile| index 3a14c4a..35bfb6b 100644 |
| --- a/Makefile |
| +++ b/Makefile |
| @@ -12,7 +12,7 @@ RELEASE_GOOS ?= linux |
| RELEASE_GOARCH ?= arm64 |
| RELEASE_BIN := releases/$(APP)-$(RELEASE_GOOS)-$(RELEASE_GOARCH) |
| -.PHONY: build release test vet fmt-check migration-check ci browser |
| +.PHONY: build release deps test vet fmt-check migration-check ci browser |
| # build is the compile check: with more than one package matched, go |
| # build discards the output, so this catches a broken package without |
| @@ -61,9 +61,27 @@ release: |
| test: |
| go test ./... |
| +# deps makes sure the module cache holds what go.sum says, and repairs it |
| +# when it does not. The CI runner's cache held an extracted |
| +# amadan.net/rastrillo/rastrillo whose embedded files (locales/*.toml, |
| +# migrations/*.sql, ui/calendar.js) were missing, so vet failed with |
| +# "pattern ...: no matching files found" while the same commit passed |
| +# here (Calendar met it first, oficina/calendar#26). `go mod verify` |
| +# names such a directory as "dir has been modified"; deleting it lets |
| +# `go mod download` extract it again from the checksummed zip. |
| +deps: |
| + @go mod download |
| + @out=$$(go mod verify 2>&1) || { \ |
| + echo "$$out"; \ |
| + echo "$$out" | sed -n 's/.*: dir has been modified (\(.*\))$$/\1/p' | while read -r dir; do \ |
| + echo "deps: re-extracting $$dir"; chmod -R u+w "$$dir" && rm -rf "$$dir"; \ |
| + done; \ |
| + go mod download && go mod verify; \ |
| + } |
| + |
| # Also vets the browser-tagged tests: they are outside `make ci`, and a |
| # test behind a tag that nothing compiles rots silently. |
| -vet: |
| +vet: deps |
| go vet ./... |
| go vet -tags browser ./internal/memoriatest/ |