Debian Codegraph @

gopls/internal/test/marker/testdata/zeroconfig/nonworkspacemodule.txt

raw
1 This test checks that gopls works with modules that aren't included in the
2 workspace file.
3
4 -- go.work --
5 go 1.20
6
7 use (
8 ./a
9 ./b
10 )
11
12 -- a/go.mod --
13 module golang.org/lsptests/a
14
15 go 1.18
16
17 -- a/a.go --
18 package a
19
20 import (
21 "fmt"
22 "golang.org/lsptests/a/lib"
23 )
24
25 func _() {
26 fmt.Println(lib.Msg) //@def("Msg", aMsg)
27 fmt.Println(undef) //@diag("undef", re"undefined|undeclared")
28 }
29
30 -- a/lib/lib.go --
31 package lib
32
33 const Msg = "hi" //@loc(aMsg, "Msg")
34
35 -- b/go.mod --
36 module golang.org/lsptests/b
37
38 go 1.18
39
40 -- b/b.go --
41 package b
42
43 import (
44 "fmt"
45 "golang.org/lsptests/b/lib"
46 )
47
48 func main() {
49 fmt.Println(lib.Msg) //@def("Msg", bMsg)
50 fmt.Println(undef) //@diag("undef", re"undefined|undeclared")
51 }
52
53 -- b/lib/lib.go --
54 package lib
55
56 const Msg = "hi" //@loc(bMsg, "Msg")
57
58 -- c/go.mod --
59 module golang.org/lsptests/c
60
61 go 1.18
62
63 -- c/c.go --
64 package c
65
66 import (
67 "fmt"
68 "golang.org/lsptests/c/lib"
69 )
70
71 func main() {
72 fmt.Println(lib.Msg) //@def("Msg", cMsg)
73 fmt.Println(undef) //@diag("undef", re"undefined|undeclared")
74 }
75
76 -- c/lib/lib.go --
77 package lib
78
79 const Msg = "hi" //@loc(cMsg, "Msg")