Documentation
¶
Overview ¶
Command sumwait blocks until the Go checksum database knows each module@version it is given, and exits 0 only then.
⛔ WHY THIS EXISTS. Right after a module is tagged, `go install mod/cmd/x@vN` fails with "verifying module: reading https://sum.golang.org/lookup/mod@vN: 404 Not Found" for about thirty minutes (seen 2026-11-29 20:57 and 21:20 for github.com/go-slides/slides@v0.31.0, tagged 20:50). The sumdb must never be bypassed (GONOSUMDB, GOFLAGS=-insecure), and a shell loop is refused by guard-bash, so the fleet needed a program that waits.
⛔ THE go COMMAND IS THE ORACLE, NOT A RE-IMPLEMENTATION OF IT. Two rounds re-implemented GOPROXY/GOSUMDB resolution here and both diverged from cmd/go (an http:// entry skipped, a "|" list that go fails but sumwait answered, a redirect to http followed...). Each round now runs the real toolchain, with the user's environment, on a throwaway module:
go mod download -json <path>@<version>
Why that call answers what `go get`/`go install` answer (Go 1.27.4 source):
- modfetch/fetch.go:480 hashZip and :856 checkGoMod call checkModSum for the zip and for the go.mod; checkModSum (:863-894) returns early ONLY when go.sum already lists the pair (:876, :884), else calls useSumDB then checkSumDB (:958) -> lookupSumDB (sumdb.go:70) -> db.Lookup, which dials the database through dbDial/initBase (sumdb.go:88, :176: GOSUMDB, the /sumdb/<name>/supported probe, TryProxies with proxy.go:138 semantics, web.DefaultSecurity redirects and http rules, GOPROXY bare hosts...).
- So the two shortcuts are closed: the throwaway module has no go.sum (it is removed before every call), and every call has a FRESH GOMODCACHE, so neither a cached zip nor a cached sumdb lookup (dbClient.ReadCache, sumdb.go:288, reads GOMODCACHE/cache/download/sumdb) can answer for it.
- The module's JSON carries Sum and GoModSum only once both were hashed AND checked, with no Error: that is the verdict VERIFIED.
⛔ THE USER'S TOOLCHAIN, RESOLVED ONCE. Every round runs with GOTOOLCHAIN=local (a switch would download a toolchain per round), so a `go` on PATH older than the module's `go` line answers "requires go >= X" forever. The user's effective toolchain is therefore resolved ONCE with `go env GOROOT` (run with the user's environment, so GOTOOLCHAIN switching applies) and every round runs <GOROOT>/bin/go. "requires go >=" is permanent (exit 2), never retried.
⛔ A CHECKSUM MISMATCH ("SECURITY ERROR") IS A VERDICT: exit 3 at once, never retried. GOFLAGS is split as cmd/go splits it (quoted.go), so a quoted -modfile/-insecure is refused too. On SIGINT/SIGTERM the go call's process group is killed and reaped before the run directory is removed (exit 130).
⛔ THREE ANSWERS, NEVER TWO. VERIFIED (exit 0 and no Error) ; ABSENT (the checksum database or the proxy answered 404/410 for THAT module@version: go's message names the module and the status) ; anything else is UNREAD, with go's message quoted (bounded and sanitised). An unread answer is not an absence, so a run whose last answer for a module was unread exits 2, never 1. Classification reads go's own message (the JSON Error field is a string, and go prints no status code), so it accepts only the shapes cmd/go emits for a 404/410 about THIS module@version; a message it does not recognise is unread.
⛔ THE LOOP IS BOUNDED BY A COUNT AND A DEADLINE, BOTH COMPUTED BEFORE THE FIRST ROUND (#327): what the database answers is not a bound this command controls. The run ends by --deadline + killMargin + waitDelay at the latest: every go call runs under one context that kills its process group.