Go "updates to go.sum needed" (GOFLAGS) - Fix in CI
go.sum must contain a checksum for every module the build uses. Under readonly mode Go will not add missing entries; it stops and points you at go mod download so the file is committed, not mutated in CI.
What this error means
A build fails with missing go.sum entry for module X; to add it: go mod download X. go.sum is incomplete and readonly mode forbids writing it.
go
missing go.sum entry for module example.com/lib; to add it:
go mod download example.com/libCommon causes
go.sum missing entries
A required module has no checksum line, so the build cannot verify it under readonly mode.
go.sum not committed after a bump
Dependencies changed but the updated go.sum was never committed.
How to fix it
Download and commit go.sum
- Populate go.sum locally and commit it.
shell
go mod download
git add go.sumAllow writes deliberately if intended
- If a job is meant to update modules, set GOFLAGS explicitly rather than relying on default.
.github/workflows/ci.yml
env:
GOFLAGS: -mod=modHow to prevent it
- Commit go.sum whenever dependencies change.
- Keep -mod=readonly in build/test jobs to catch missing entries.
- Only use -mod=mod in jobs whose purpose is updating modules.
Related guides
Go "go.mod inconsistent" with -mod=readonly - Fix in CIFix Go failing under -mod=readonly because go.mod/go.sum are out of date in CI - run go mod tidy locally and…
Go "checksum mismatch" (GONOSUMDB) - Fix in CIFix Go "checksum mismatch" / "verifying module: checksum mismatch" in CI - go.sum disagrees with the download…
Go "cannot find package" (vendor stale) - Fix in CIFix Go "cannot find package" in CI when the vendor directory is stale - go.mod added a dependency that was ne…