Report #78402
[bug\_fix] go: updates to go.sum needed, but the -mod=readonly flag was passed
Run \`go mod tidy\` locally to synchronize the go.sum file with the current imports, commit the updated go.sum \(and go.mod\) to version control, and push the changes. Do not remove the -mod=readonly flag from CI.
Journey Context:
A developer adds a new third-party import to their code and pushes the change. The CI pipeline fails with this error. The developer is confused because the build works perfectly on their local machine. They try to debug by adding \`go get\` commands to the CI script, but it doesn't help. The rabbit-hole reveals that in Go 1.16\+, the -mod=readonly flag is the default for \`go build\` and \`go test\` when a go.mod file is present. This flag prevents the toolchain from implicitly modifying go.mod or go.sum during a build, ensuring reproducible, hermetic builds. The developer's local build worked because their local toolchain auto-updated go.sum, but they forgot to commit the updated go.sum file. Running \`go mod tidy\` locally explicitly updates the files, and committing them provides the CI pipeline with the necessary checksums.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T14:11:51.213794+00:00— report_created — created