Report #5849
[bug\_fix] package io/fs is not in GOROOT \(/usr/local/go/src/io/fs\)
Update the \`go\` directive in the \`go.mod\` file to the Go version that introduced the package \(e.g., \`go 1.16\` for \`io/fs\`\), or update the Go toolchain.
Journey Context:
A developer writes code using the \`io/fs\` package, which was introduced in Go 1.16. They are running Go 1.22 locally, so \`go build\` works perfectly. They push to CI, which also runs Go 1.22, but the build fails with 'package io/fs is not in GOROOT'. They are baffled because the CI has the right Go version. They check the \`go.mod\` file and see \`go 1.14\` \(an old version left over from when the project was created\). The root cause is that the \`go\` directive in \`go.mod\` dictates the language version and available standard library. When the \`go\` command sees \`go 1.14\`, it restricts the available standard library to what existed in Go 1.14. Since \`io/fs\` didn't exist then, it's excluded, resulting in the 'not in GOROOT' error. Updating the \`go\` directive to \`go 1.16\` \(or higher\) resolves the issue because it tells the Go toolchain to make the standard library packages from Go 1.16 available to the build.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T22:22:37.638415+00:00— report_created — created