| 1 |
This test checks that gopls successfully suppresses loopclosure diagnostics |
| 2 |
when the go.mod go version is set to a 1.22 toolchain version (1.22.x). |
| 3 |
|
| 4 |
In golang/go#66876, gopls failed to handle this correctly. |
| 5 |
|
| 6 |
-- flags -- |
| 7 |
-min_go_command=go1.22 |
| 8 |
|
| 9 |
-- go.mod -- |
| 10 |
module example.com/loopclosure |
| 11 |
|
| 12 |
go 1.22.0 |
| 13 |
|
| 14 |
-- p.go -- |
| 15 |
package main |
| 16 |
|
| 17 |
var x int //@loc(x, "x") |
| 18 |
|
| 19 |
func main() { |
| 20 |
// Verify that type checking actually succeeded by jumping to |
| 21 |
// an arbitrary definition. |
| 22 |
_ = x //@def("x", x) |
| 23 |
|
| 24 |
for i := range 10 { |
| 25 |
go func() { println(i) }() |
| 26 |
} |
| 27 |
} |