| 1 |
This test checks the behavior of standalone packages, in particular documenting |
| 2 |
our failure to support test files as standalone packages (golang/go#64233). |
| 3 |
|
| 4 |
-- go.mod -- |
| 5 |
module golang.org/lsptests/a |
| 6 |
|
| 7 |
go 1.20 |
| 8 |
|
| 9 |
-- a.go -- |
| 10 |
package a |
| 11 |
|
| 12 |
func F() {} //@loc(F, "F") |
| 13 |
|
| 14 |
-- standalone.go -- |
| 15 |
//go:build ignore |
| 16 |
package main |
| 17 |
|
| 18 |
import "golang.org/lsptests/a" |
| 19 |
|
| 20 |
func main() { |
| 21 |
a.F() //@def("F", F) |
| 22 |
} |
| 23 |
|
| 24 |
-- standalone_test.go -- |
| 25 |
//go:build ignore |
| 26 |
package main //@diag("main", re"No packages found") |
| 27 |
|
| 28 |
import "golang.org/lsptests/a" |
| 29 |
|
| 30 |
func main() { |
| 31 |
a.F() //@hovererr("F", "no package") |
| 32 |
} |
| 33 |
|
| 34 |
-- standalone_x_test.go -- |
| 35 |
//go:build ignore |
| 36 |
package main_test //@diag("main", re"No packages found") |
| 37 |
|
| 38 |
import "golang.org/lsptests/a" |
| 39 |
|
| 40 |
func main() { |
| 41 |
a.F() //@hovererr("F", "no package") |
| 42 |
} |
| 43 |
|