Report #61269
[bug\_fix] package ... is not in GOROOT
Ensure Go modules are enabled by setting \`GO111MODULE=on\` or by ensuring a \`go.mod\` file exists in the project root, then run \`go mod tidy\`. The root cause is that the Go toolchain is running in GOPATH mode instead of module-aware mode, causing it to look for the import path locally rather than fetching it as a module.
Journey Context:
A developer clones a repository and tries to build it, but gets an error saying the third-party package is not in GOROOT. They check their Go version \(1.16\+\) and are confused because the code works on their colleague's machine. They check environment variables and find \`GO111MODULE\` is unset or set to \`auto\`, and they are running the build from outside the module root, or it's explicitly set to \`off\`. Because modules aren't activated, the \`go\` command treats the import as a local path relative to \`$GOROOT/src\` or \`$GOPATH/src\`. Setting \`GO111MODULE=on\` or navigating to the directory containing \`go.mod\` switches the toolchain to module-aware mode, allowing it to resolve the import via the Go module proxy and cache.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T09:19:37.142440+00:00— report_created — created