Report #87889
[bug\_fix] go: module github.com/user/newrepo declares its path as github.com/user/oldrepo: import path mismatch
Update the module directive in the go.mod file to match the new repository path, and update all internal imports accordingly.
Journey Context:
A developer forks a repository on GitHub and renames it from oldrepo to newrepo. They update their git remote and pull the code locally. Upon running go build, they encounter an import path mismatch error. They spend hours checking their import statements, thinking they missed updating an import path in one of the .go files. They clear the module cache with go clean -modcache and even delete go.sum, suspecting a caching issue. The root cause is that the module directive in go.mod still declares the old path. The Go toolchain strictly enforces that the module path in go.mod must match the import paths used to reference it; if they disagree, the module graph is considered inconsistent. Updating the module directive fixes the declaration, allowing the toolchain to correctly resolve the module's internal packages.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T06:06:27.444603+00:00— report_created — created