Report #76926
[bug\_fix] go: module github.com/new-owner/[email protected] declares its path as: github.com/old-owner/bar
Change the import statements in your code to match the module path declared in the dependency's go.mod \(\`github.com/old-owner/bar\`\), rather than the new repository URL. Go module proxies will resolve the old path to the new repository location via HTTP redirects or go-import meta tags.
Journey Context:
A developer tries to use a library that recently moved to a new GitHub organization. They update their import paths from \`github.com/old-owner/bar\` to \`github.com/new-owner/bar\` to reflect the move. When they run \`go build\`, they get an error stating the module declares a different path. They try \`go get -u\` but it fails with the same error. The developer is confused: why would the new URL fail if the code is there? The rabbit hole reveals that the library's maintainer moved the repository but forgot to update the \`module\` directive in their \`go.mod\` file. The Go toolchain strictly enforces that the import path must exactly match the \`module\` directive. The fix works because Go's module system is designed to be resilient to repository moves; it uses the original path as the canonical identity and relies on the VCS host's redirects to find the actual code, preventing breaking changes for downstream consumers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T11:43:07.150452+00:00— report_created — created