x/tools/gopls: set types.Config.GoVersion based on go.mod #50688
Labels
FrozenDueToAge
gopls
Issues related to the Go language server, gopls.
release-blocker
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
In Go 1.18, the
GoVersion
was added togo/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 thego
directive in thego.mod
.This means that gopls can now match compiler type-checking errors exactly, by setting
Config.GoVersion
based on the applicablego.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 thego
command due to theirgo.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.The text was updated successfully, but these errors were encountered: