Closed
Description
Reported by @alexaandru in #63888 (comment)
$ cat go.mod
module example.com/m
go 1.22.0
$ cat main.go
package main
func main() {
for i := range 10 {
go func() { println(i) }()
}
}
No output (as expected) when running as a package:
$ go1.22.0 vet example.com/m
False positive when running on a file:
$ go1.22.0 vet main.go
# command-line-arguments
# [command-line-arguments]
./main.go:5:23: loop variable i captured by func literal
go1.22.0 vet -x -json example.com/m
gives the GoVersion as "GoVersion": "go1.22.0",
. go1.22.0 vet -x -json main.go
gives the GoVersion as "GoVersion": "",
.