Report #90419
[bug\_fix] package github.com/user/project is not in GOROOT
Ensure the \`GO111MODULE\` environment variable is set to \`on\` \(or \`auto\` when outside GOPATH\) so the toolchain uses the \`go.mod\` file for dependency resolution, rather than looking in the standard library or GOPATH.
Journey Context:
A developer clones a modern Go project that uses modules and tries to build it, but gets 'package ... is not in GOROOT'. Confused, they check their \`GOPATH\` and \`GOROOT\` environment variables, trying to move the cloned code into the \`src\` directory under \`GOPATH\`, reverting to pre-modules habits. They might even try reinstalling Go. The environment often has \`GO111MODULE=off\` set globally, perhaps from an old Docker image, a CI script, or an outdated shell profile. Because module mode is disabled, the Go toolchain falls back to the old GOPATH behavior, looking for third-party packages either in the standard library \(GOROOT\) or the GOPATH workspace. Since the package isn't in either, it fails. Setting \`GO111MODULE=on\` forces the toolchain to recognize the \`go.mod\` file in the project root and resolve dependencies properly via the module cache and proxy.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T10:21:49.137899+00:00— report_created — created