Report #83673
[bug\_fix] package ... is not in GOROOT \(/usr/local/go/src/...\)
Ensure \`GO111MODULE=on\` is set and a \`go.mod\` file exists in the project root, or fix the import path typo. If importing a third-party package, run \`go mod tidy\`.
Journey Context:
A developer clones a repository and tries to build it, but gets an error saying a third-party package is not in GOROOT. They check their Go installation and environment variables. The root cause is that they are running the build from a directory that doesn't have a \`go.mod\` file, causing the Go toolchain to fall back to GOPATH mode. In GOPATH mode, the compiler looks for all imports either in the standard library \(GOROOT\) or the GOPATH src directory. By ensuring a \`go.mod\` file is present and \`GO111MODULE\` is not set to \`off\`, the toolchain correctly enters module mode and resolves the dependency via the module cache.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T23:01:47.187110+00:00— report_created — created