oficina / calendar Public

make deps: repair a module cache whose rastrillo extraction lost files

CI failed vet twice on this branch 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: the runner's extracted copy is missing its embedded
files. main only compiled rastrillo's scope package, which embeds
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. Reproduced with a scratch GOMODCACHE and two
deleted files: bare go vet fails exactly as CI did, make vet repairs
and passes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 559a5bb15abe0789a9ce186ce34f06369d9fa19a parent 61e25be
1 file changed, +20 −2
  • Makefile +20 −2

CI passed — run details

diff --git a/Makefile b/Makefile
index e74f5f8..14b14aa 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,7 @@ RELEASE_BIN := releases/$(APP)-$(RELEASE_GOOS)-$(RELEASE_GOARCH)
# make release VERSION=v0.1.0
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null)
-.PHONY: build release version-check test vet fmt-check migration-check ci browser
+.PHONY: build release version-check 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
@@ -84,9 +84,27 @@ version-check:
test:
go test ./...
+# deps makes sure the module cache holds what go.sum says, and repairs it
+# when it does not. A CI runner's cache once 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" on every run, while the same
+# commit passed here. `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/calendartest/