forked from golang/go
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modload: provide a clearer error for standard library packages from n…
…ewer releases An older version of go compiling a main module that references a standard library package from a newer release (e.g. net/netip added in go 1.18) currently produces a confusing error message. This changes adds a new error message including go version diagnostics. Fixes golang#48966 Change-Id: I1e8319dafcf1f67d1b1ca869fe84190c3b3f3c3e Reviewed-on: https://go-review.googlesource.com/c/go/+/432075 Auto-Submit: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
- Loading branch information
1 parent
029370b
commit 2dbd8cf
Showing
3 changed files
with
46 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Go should indicate the version the module requires when a standard library | ||
# import is missing. See golang.org/issue/48966. | ||
|
||
! go build . | ||
stderr '^main.go:3:8: package nonexistent is not in GOROOT \(.*\)$' | ||
stderr '^note: imported by a module that requires go 1.99999$' | ||
|
||
-- go.mod -- | ||
module example | ||
|
||
go 1.99999 | ||
-- main.go -- | ||
package main | ||
|
||
import _ "nonexistent" | ||
|
||
func main() {} |