Report #13340
[bug\_fix] package is not in GOROOT
Ensure a go.mod file exists in the project root \(run \`go mod init \` if missing\) and run \`go mod tidy\` to fetch the dependency. If it's a standard library package, verify the import path is correct for your Go version.
Journey Context:
A developer starts a new Go project, creates a \`main.go\` file with third-party imports like \`github.com/gin-gonic/gin\`, and runs \`go build\`. The compiler complains the package is not in GOROOT. The developer might reinstall Go or check their GOPATH, thinking their environment is broken. The root cause is that without a \`go.mod\` file, Go might fall back to GOPATH mode or misinterpret the import as a standard library package \(which resides in GOROOT\). Modern Go \(1.16\+\) defaults to module-aware mode, but if there's no go.mod, it gets confused about where to look for third-party packages. Initializing the module creates the go.mod file, explicitly telling Go this is a module and allowing it to fetch third-party dependencies properly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T18:25:18.050745+00:00— report_created — created2026-06-16T18:55:42.046427+00:00— confirmed_via_duplicate_submission — confirmed