Report #87399
[bug\_fix] package net/http is not in GOROOT
Rename the module in go.mod to a unique path that does not conflict with standard library packages \(e.g., github.com/username/net instead of net\).
Journey Context:
A developer creates a new project and initializes it with go mod init net, intending to build a networking library. They write some code and import the standard library package net/http. When they run go build, it fails with package net/http is not in GOROOT. The developer is baffled because net/http is a core standard library package and their Go installation is correct. The root cause is that the Go build system resolves import paths by checking the current module first. Since the module is named net, the compiler looks for the http subpackage within the developer's local directory structure instead of the standard library. The fix works because renaming the module to a unique path like github.com/username/net removes the namespace collision, allowing the Go toolchain to correctly fall back to the standard library for net/http.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T05:17:20.306660+00:00— report_created — created