Report #31272
[bug\_fix] package io/fs is not in GOROOT \(/usr/local/go/src/io/fs\)
Update the \`go\` directive in \`go.mod\` to the required Go version \(e.g., \`1.16\`\), ensure the local Go toolchain is updated to match, and run \`go mod tidy\`.
Journey Context:
A developer imports a new package or pulls a dependency that relies on the \`io/fs\` package introduced in Go 1.16. Upon running \`go build\`, the compiler complains that \`io/fs\` is not in GOROOT. The developer mistakenly assumes \`io/fs\` is a third-party package and tries \`go get io/fs\`, which fails. They might also try reinstalling Go or checking their GOROOT environment variable. The root cause is that their \`go.mod\` file specifies an older Go version \(like \`1.15\`\), and their local Go installation might also be older. The Go toolchain strictly enforces the \`go\` directive in \`go.mod\`, meaning it only includes standard library packages that existed in that version. Updating the Go toolchain and the \`go.mod\` directive resolves the issue because it makes the newer standard library available to the build system.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:52:36.948721+00:00— report_created — created