Report #65784
[bug\_fix] package github.com/example/project is not in GOROOT
Ensure Go is running in module-aware mode by checking that GO111MODULE is not set to off, and that you are running the build command from within a directory containing a go.mod file or a subdirectory of one.
Journey Context:
A developer clones a new repository and runs go build. They get an error saying the package is not in GOROOT. They check their GOPATH and GOROOT environment variables, which look correct. They try go env GO111MODULE and see it's set to off because an old shell profile script from pre-Go 1.11 days is overriding the default. In Go 1.16\+, module-aware mode is the default, but GO111MODULE=off forces Go into the legacy GOPATH mode, where it looks for imports strictly in GOROOT or GOPATH/src. The fix is to remove GO111MODULE=off from their shell profile and restart the terminal, allowing Go to use modules. This works because module-aware mode reads the go.mod file to resolve dependencies instead of relying on the GOPATH directory structure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T16:54:14.300314+00:00— report_created — created