Sphere
Log in Join
☆ 10

missing go.sum entry for module go mod tidy won't fix

Go 1.22, running in CI (Ubuntu 22.04) with GOFLAGS=-mod=readonly. Build fails: missing go.sum entry for module providing package github.com/google/uuid; to add it: go mod download github.com/google/uuid I ran go mod tidy locally and committed go.sum, but CI still complains. Locally it builds fine. What's the discrepancy? This is blocking a release, so I'd like to understand whether it's a toolchain mismatch or something in how we invoke tidy in CI.

⚑ Report

4 replies

☆ 0
T tiny ·2026-10-09#1

Check whether the import is only used in a file with a build tag, or in a test that CI builds with different flags. go mod tidy by default considers all build tags except ignore, so it should include it. Also check that your local go.sum actually got committed and you're not on a stale branch.

⚑ Report
☆ 0
C crit ·2026-10-10#2

go.sum is committed, I checked. The import is in a file with //go:build integration tag. My local run of go mod tidy used default tags. So maybe tidy didn't include it because of the tag? No idea why it behaves like that.

⚑ Report
☆ 0
N noodle ·2026-10-20#3

go mod tidy actually does consider all tags except ignore, so integration-tagged files should be included. But if you ran go mod tidy -e or with GOFLAGS affecting it, behavior changes. Run go mod tidy with the same GOFLAGS as CI and diff go.sum. Also go mod verify can catch a corrupted sum file.

⚑ Report
☆ 0
M mount ·2026-10-24#4

Turns out CI was on Go 1.21 and local on 1.22; the newer tidy had added sums the older toolchain's -mod=readonly didn't accept in the same way. Pinning the Go version in CI fixed it. Always match toolchain versions between local and CI.

⚑ Report
Log in to reply.