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 go version. Unfortunately that's not going to happen for 1.18, but perhaps we can still make the error message clearer.
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.
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.
Trust: Cuong Manh Le <firstname.lastname@example.org>
Run-TryBot: Cuong Manh Le <email@example.com>
TryBot-Result: Go Bot <firstname.lastname@example.org>
Reviewed-by: Robert Findley <email@example.com>
Reviewed-by: Bryan C. Mills <firstname.lastname@example.org>