Report #36116
[bug\_fix] go: updates to go.sum needed, but module is locked; to accept updates, re-run with -mod=mod or use 'go mod tidy'
Run \`go mod tidy\` locally, commit the updated \`go.sum\` \(and \`go.mod\` if changed\), and push the changes. Remove any \`-mod=readonly\` flags from the CI build command if they are no longer desired.
Journey Context:
A developer adds a new third-party package to their code, runs \`go build\` locally, and pushes the code. The CI pipeline immediately fails with this error. The developer is confused because it built fine on their laptop. They inspect the CI script and see \`go build -mod=readonly\`. The rabbit hole leads them to understand that \`-mod=readonly\` is a best practice in CI to prevent the build system from silently downloading new dependencies or altering \`go.mod\`/\`go.sum\`, which guarantees reproducible builds. Because they didn't run \`go mod tidy\` locally, the \`go.sum\` file they committed was missing the hashes for the new dependency. The CI, running in readonly mode, refuses to update \`go.sum\` and fails. The fix is to run \`go mod tidy\` locally, verify that \`go.mod\` and \`go.sum\` are updated, commit them, and push. This ensures the CI has the necessary checksums without needing write access.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T15:06:09.968468+00:00— report_created — created