Report #87390
[bug\_fix] module github.com/foo/[email protected] declares its path as: github.com/foo/bar/v2, but was required as: github.com/foo/bar
Update the import paths in the Go source files to include the /v2 suffix, and update the go.mod requirement using go get github.com/foo/bar/[email protected].
Journey Context:
A developer tries to update a dependency to its latest major version by running go get github.com/foo/[email protected]. The command succeeds, but subsequent go build fails with a module path mismatch error. They attempt to clear the module cache or delete go.sum, but the error persists. The root cause is Go's Semantic Import Versioning rule: modules with major version 2 or higher must include the major version suffix in their module path. The go.mod file of the dependency correctly declares module github.com/foo/bar/v2, but the developer's code and go.mod still reference the v1 path github.com/foo/bar. The fix works because updating the import paths to github.com/foo/bar/v2 aligns the source code imports with the module's declared path, satisfying the Go toolchain's strict path validation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T05:16:30.033968+00:00— report_created — created