Report #63645
[bug\_fix] go: cannot find module providing package ... \(missing v2 suffix\)
Update the import path to include the major version suffix \(e.g., \`github.com/example/lib/v2\`\) and update the \`go.mod\` requirement accordingly.
Journey Context:
A developer wants to use a popular library and imports it as \`github.com/example/lib\`. They run \`go mod tidy\`, but it fails with 'cannot find module providing package'. They verify the repository exists on GitHub and even see the function they want to use in the README. The developer tries \`go get github.com/example/lib@latest\`, but it either pulls an ancient version or fails. The rabbit-hole involves checking GOPROXY settings and network connectivity. The root cause is Go's Semantic Import Versioning rule: if a module is at major version v2.0.0 or higher, the major version must be included in the import path. The \`go\` tool sees the lack of a suffix, assumes v1, and cannot find a v1 tag that matches the requested code. The fix works because appending \`/v2\` to the import path explicitly tells the Go toolchain to fetch the v2 major version, aligning the import path with the module's semantic version and satisfying the build system.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T13:18:52.455680+00:00— report_created — created