| 1 |
This test checks that gopls works with multiple ad-hoc packages, which lack |
| 2 |
a go.mod file. |
| 3 |
|
| 4 |
We should be able to import standard library packages, get diagnostics, and |
| 5 |
reference symbols defined in the same directory. |
| 6 |
|
| 7 |
-- main.go -- |
| 8 |
package main |
| 9 |
|
| 10 |
import "fmt" |
| 11 |
|
| 12 |
func main() { |
| 13 |
fmt.Println(mainMsg) //@def("mainMsg", mainMsg) |
| 14 |
fmt.Println(undef) //@diag("undef", re"undefined|undeclared") |
| 15 |
} |
| 16 |
-- main2.go -- |
| 17 |
package main |
| 18 |
|
| 19 |
const mainMsg = "main" //@loc(mainMsg, "mainMsg") |
| 20 |
|
| 21 |
-- a/a.go -- |
| 22 |
package a |
| 23 |
|
| 24 |
import "fmt" |
| 25 |
|
| 26 |
func _() { |
| 27 |
fmt.Println(aMsg) //@def("aMsg", aMsg) |
| 28 |
fmt.Println(undef) //@diag("undef", re"undefined|undeclared") |
| 29 |
} |
| 30 |
|
| 31 |
-- a/a2.go -- |
| 32 |
package a |
| 33 |
|
| 34 |
const aMsg = "a" //@loc(aMsg, "aMsg") |
| 35 |
|
| 36 |
-- b/b.go -- |
| 37 |
package b |
| 38 |
|
| 39 |
import "fmt" |
| 40 |
|
| 41 |
func _() { |
| 42 |
fmt.Println(bMsg) //@def("bMsg", bMsg) |
| 43 |
fmt.Println(undef) //@diag("undef", re"undefined|undeclared") |
| 44 |
} |
| 45 |
|
| 46 |
-- b/b2.go -- |
| 47 |
package b |
| 48 |
|
| 49 |
const bMsg = "b" //@loc(bMsg, "bMsg") |