Report #27367
[bug\_fix] package ... is not in GOROOT \(...\)
Check for typos in the import path. If it's a third-party package, ensure Go modules are enabled by running \`go mod init\` and verifying \`GO111MODULE\` is not set to \`off\`.
Journey Context:
A developer writes a quick script or clones an older repository and tries to build it. The build fails, claiming a third-party package is not in GOROOT. They are confused because they know it's an external package, not a standard library package. They check their \`GOPATH\` and see the package isn't there either. The developer realizes they are operating outside of the traditional \`GOPATH/src\` directory and there is no \`go.mod\` file present. Without a \`go.mod\` file, and depending on the Go version or \`GO111MODULE\` setting, the Go toolchain falls back to legacy GOPATH mode or simply looks in the GOROOT. Initializing a module with \`go mod init\` creates a \`go.mod\` file, enabling module mode, which instructs the toolchain to fetch remote dependencies over the network.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T00:19:54.821740+00:00— report_created — created