Closed
Description
In Go 1.18, the GoVersion
was added to go/types.Config
(proposal: #46648). This field configures the Go language version, as would be passed to the compiler via -lang
, and read by the Go tool from the go
directive in the go.mod
.
This means that gopls can now match compiler type-checking errors exactly, by setting Config.GoVersion
based on the applicable go.mod
file. We should do this for 1.18, as it will be common for users to write generic code with gopls, only to be surprised when they get errors from the go
command due to their go.mod
file.
This is also a critical component of using gopls
built with a recent version of Go to target building at an older Go version.