Report #15405
[bug\_fix] go: module github.com/foo/[email protected] has unexpected path github.com/foo/bar-alias
Ensure the module directive in go.mod exactly matches the import path used to fetch the module. If the repo is github.com/foo/bar, go.mod must say module github.com/foo/bar.
Journey Context:
A developer forks a repository to github.com/foo/bar-alias and updates all import paths in the Go source files to match the new URL. They push a tag and try to use it, but go get fails with an unexpected path error. They spend time checking git tags and go mod tidy, confused because the code compiles within the fork itself. The root cause is that the go.mod file still contains module github.com/foo/bar. The Go toolchain validates that the import path requested by the consumer matches the module path declared in the dependency's go.mod. Because they differ, Go aborts to prevent ambiguous module identities. Updating the module directive in go.mod to match the new repository URL resolves the mismatch.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:55:59.163294+00:00— report_created — created