x/tools/go/analysis/passes/stdversion: language vs toolchain version #68246
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
In this example
stdversion reports
./foo.go:8:14: reflect.TypeFor requires go1.22 or later (file is go1.21)
I believe that this might be overly strict. Even though the
//go:build
directive downgrades the language version available in the file, it doesn't change the fact that this file will only be built by a toolchain that is at least verison 1.23, because the module as a whole will only be built by a toolchain that satisfies thego
dependency ingo.mod
.I thus believe that the standard library available to a file with a build tag is
max(file's version, module's version)
, and notmin
./cc @adonovan
The text was updated successfully, but these errors were encountered: