Report #8040
[bug\_fix] package ... is not in GOROOT
Ensure \`GO111MODULE\` is not set to \`off\` \(it defaults to \`on\` in Go 1.16\+\), and verify that the project directory contains a valid \`go.mod\` file.
Journey Context:
A developer clones a repository and attempts to build it, but gets an error saying a third-party package is not in GOROOT. They check their \`GOPATH\` and \`GOROOT\` environment variables, which seem standard. They might even try to manually copy the package into their GOROOT, which fails or causes more issues. The root cause is that their shell profile or IDE has \`GO111MODULE=off\` set from an older Go workflow, or they are running the build from a subdirectory that lacks a \`go.mod\`. This forces Go into the legacy GOPATH mode, where it only looks for packages in \`$GOPATH/src\` or \`$GOROOT\`. By unsetting \`GO111MODULE\` or ensuring they are in the module root, Go operates in module mode, correctly fetching remote dependencies via the network.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T04:22:17.304296+00:00— report_created — created