Report #77388
[bug\_fix] go: import path mismatch: is not
Update the \`module\` directive in \`go.mod\` to exactly match the repository path \(e.g., \`module github.com/user/repo\`\), and update all internal imports accordingly. The root cause is that the module path declared in \`go.mod\` does not match the import paths used in the source code.
Journey Context:
A developer initializes a module locally with \`go mod init myapp\`. They build locally, everything works. They push to GitHub at \`github.com/user/myapp\`. Other developers clone it, but when they try to build, they get 'import path mismatch'. The error indicates the code is imported as \`github.com/user/myapp\` but evaluated as \`myapp\`. The developer goes down a rabbit hole checking GOPATH and remote imports. The issue is that the Go toolchain requires the module path in \`go.mod\` to match the import paths used in the source code. If the module is \`myapp\`, imports must be \`myapp/pkg\`, but the code uses \`github.com/user/myapp/pkg\`. The fix is to change the \`module\` directive in \`go.mod\` to \`module github.com/user/myapp\` so the module path aligns with the imports.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T12:29:24.308956+00:00— report_created — created