Skip to content

x/tools/go/analysis/passes/stdversion: spurious reports in files tagged //go:build 1.<old> #67123

Closed
@adonovan

Description

@adonovan

The stdversion analyzer, which will soon become part of the vet suite (see https://go.dev/cl/582556), gives false positives when run on files that, although part of modules with recent Go versions, have old build tags. In this example from x/build, the file is tagged 1.16 even though the module requires go1.21.

stdversion should only honor the file version if it is greater than the module version. (And perhaps some other tool should warn when a file's build tag is so old that it becomes redundant with the module version.)

x/build$ go vet -c=0 ./cmd/coordinator
cmd/coordinator/buildstatus.go:1005:37: strings.Cut requires go1.18 or later (file is go1.16)
1005			switch pkg, variant, _ := strings.Cut(new, ":"); {

Metadata

Metadata

Assignees

Labels

AnalysisIssues related to static analysis (vet, x/tools/go/analysis)FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions