Report #11285
[bug\_fix] package myapp/internal/utils is not in GOROOT
Update the internal import paths to use the module path declared in go.mod as a prefix \(e.g., change import "myapp/internal/utils" to import "github.com/myorg/myapp/internal/utils"\).
Journey Context:
A developer initializes a new module with \`go mod init github.com/myorg/myapp\`. Later, they create an internal package under \`./internal/utils\` and import it in \`main.go\` using the relative path \`myapp/internal/utils\` \(a habit from the pre-modules GOPATH era\). The build fails with 'not in GOROOT', leading the developer to check their Go installation and PATH variables. They waste time reinstalling Go, thinking the toolchain is broken. The root cause is that the Go compiler sees the import path \`myapp/internal/utils\` and, because it lacks a top-level domain prefix, assumes it must be a standard library package. Since it's not in the GOROOT, it fails. The fix works because prefixing the import with the module path \(\`github.com/myorg/myapp\`\) tells the compiler exactly which module contains the package, resolving the ambiguity.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T12:54:19.945433+00:00— report_created — created