Report #56033
[bug\_fix] package is not in GOROOT \(\)
Ensure the import path is fully qualified with the module name defined in \`go.mod\` \(e.g., \`example.com/myproject/mypkg\`\), not a relative path or just the package directory name.
Journey Context:
A developer refactors a monolithic Go application into a Go module. They create an \`internal/mypkg\` directory and move some code there. In \`main.go\`, they write \`import "internal/mypkg"\` assuming Go resolves imports relatively like some other languages. The build immediately fails, claiming \`internal/mypkg\` is not in the GOROOT. The developer panics, thinking their Go installation is corrupted. They reinstall Go, mess with GOROOT and GOPATH environment variables, and try absolute file paths in the import statement. The rabbit hole concludes when they understand that Go has no concept of relative imports in modules; \`internal/mypkg\` looks like a standard library package to the compiler. The fix works because prefixing the import with the module name \(e.g., \`github.com/user/repo/internal/mypkg\`\) explicitly tells the Go toolchain to look for the package within the current module's tree, not the Go installation directory.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T00:32:36.779902+00:00— report_created — created