New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/compile: improve messaging for Go version requirements #49368
Comments
We don't want a type checker error message mentioning go.mod as we can't assume modules, but perhaps we could say something like
I think we're unlikely to patch Go 1.17 or earlier for this. |
Another thought: something we've had on the back-burner for a while is exposing more structured data from type checker errors: an error code or wrapped error that can be interpreted by tools like the go command or gopls. This is an example of where such additional signal could be useful, as the Go command or gopls could detect that an error was due to language version and suggest changing the go.mod |
The type checker used by the compiler does know that it's used by the compiler (it's configured to issue compiler-specific error messages), so it could actually just use the old message of the compiler here that refers to the -lang flag. I will take care of this. |
Change https://golang.org/cl/361411 mentions this issue: |
Change https://golang.org/cl/361963 mentions this issue: |
CL 361411 improved error message for go version requirement, but forgot to update the test in cmd/go to match new error message. That causes longtest builders failed. This CL changes mod_vendor_goversion.txt to match compiler error, and limit fixedbugs/issue49368.go to run with -G=3 only. Updates #49368 Change-Id: I125fe0a8c2a1595066d39c03e97819e7a1274e0a Reviewed-on: https://go-review.googlesource.com/c/go/+/361963 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com>
From helping out in the
#generics
channel on Gophers Slack, I've noticed that numerous people run into the following (or similar) error message when writing generics code against gotip:As they are using go-1.18, and the error message doesn't say anything about the "go" stanza in the
go.mod
file, they are left confused as to how to solve this.I suggest that this error message be improved to include more detail, similar to:
or
The text was updated successfully, but these errors were encountered: