Report #58056
[bug\_fix] go: found module example.com/pkg/v2 but package imports example.com/pkg
Update the import paths in the Go source code to include the major version suffix \(e.g., import "example.com/pkg/v2"\) to match the module path.
Journey Context:
A developer decides to upgrade a dependency to its new major version by running \`go get example.com/[email protected]\`. The go.mod file updates successfully to require v2. However, when they run \`go build\`, they get an error stating the module path doesn't match the import path. They check the go.mod and see \`example.com/pkg/v2\`, but their code still has \`import "example.com/pkg"\`. The root cause is Go's Semantic Import Versioning rule: modules with major version 2 or higher must include the major version in their module path, making v2 a distinct module from v1. The fix is to do a project-wide find-and-replace, updating all import statements from \`example.com/pkg\` to \`example.com/pkg/v2\` so the import path aligns with the module path defined in the dependency's go.mod.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T03:56:09.036366+00:00— report_created — created