Report #5688
[bug\_fix] package ... is not in GOROOT
Check for typos in the import path. If it is a third-party package, ensure it is properly imported and run go mod tidy to fetch it into the module cache rather than GOROOT.
Journey Context:
A developer writes import "github.com/some/pakcage" \(with a typo\) or tries to import a standard library package like "http" instead of "net/http". The build fails with "package ... is not in GOROOT". They are confused because they think GOROOT is only for the standard library, so why is it looking for a GitHub package there? They dive into a rabbit hole of checking their GOROOT and GOPATH environment variables, thinking their Go installation is broken, and might even reinstall Go. The root cause is that when Go modules are enabled, if the go tool cannot find a module that provides the imported package in the module cache or go.mod, it falls back to checking the standard library \(GOROOT\). If it is not there, it reports "not in GOROOT". Fixing the typo or running go mod tidy to properly resolve the dependency resolves the lookup failure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T21:53:05.077434+00:00— report_created — created