cmd/go: missing version diagnostic when a package in the main module imports a package from a newer release #48966
I realise this might cause breakage for modules who's authors use the highes available go version as part of their
The text was updated successfully, but these errors were encountered:
For an end user that tries to self-compile its impossible to relate this error in a mismatching go version.
That report is from
That version of Go is way out of date: per the Go project's release policy, the current supported versions of the toolchain are 1.16.9 and 1.17.2.
Any change we would make at this point would only affect 1.18 and later, and I posit that the supported versions of the toolchain already produce a much more useful diagnostic in this case.
Hmm... It is the case that
It looks like the failure in module resolution is before the failure due to the Go version.
And if we construct a similar situation with some new 1.18 package using Go 1.17.2, we still get a bad error message:
So there is a bug to be fixed here — but it's just a bug, it doesn't need to go through the proposal process.
@zacho314, the error message that we see is from an
Generally when we see an
I suspect that the point where we're reporting the error today is here:
What we need to propagate this error correctly is something like:
We already have a “for each package
…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 <email@example.com> Run-TryBot: Bryan Mills <firstname.lastname@example.org> Reviewed-by: Bryan Mills <email@example.com> TryBot-Result: Gopher Robot <firstname.lastname@example.org>