Debian Codegraph @

gopls/internal/test/marker/testdata/definition/comment.txt

raw
1 This test executes definition requests over doc links.
2
3 -- go.mod --
4 module mod.com
5
6 go 1.19
7
8 -- path/path.go --
9 package path
10
11 func Join() //@loc(Join, "Join")
12
13 -- a.go --
14 package p
15
16 import "strconv" //@loc(strconv, `"strconv"`)
17 import pathpkg "mod.com/path"
18 import _ "unsafe"
19
20 const NumberBase = 10 //@loc(NumberBase, "NumberBase")
21
22 // [Conv] converts s to an int. //@def("Conv", Conv)
23 func Conv(s string) int { //@loc(Conv, "Conv")
24 // [strconv.ParseInt] parses s and returns the integer corresponding to it. //@def("strconv", strconv)
25 // [NumberBase] is the base to use for number parsing. //@def("NumberBase", NumberBase)
26 i, _ := strconv.ParseInt(s, NumberBase, 64)
27 return int(i)
28 }
29
30 type T struct {
31 Field int //@ loc(Field, "Field")
32 }
33
34 func (T) Method() {} //@ loc(Method, "Method")
35
36 // The declared and imported names of the package both work:
37 // [path.Join] //@ def("Join", Join)
38 // [pathpkg.Join] //@ def("Join", Join)
39 //
40 // Also, both [T.Field] and //@ def("Field", Field)
41 // [T.Method] are supported. //@ def("Method", Method)
42 func _() {
43 pathpkg.Join()
44 }
45
46 // Built-in and unsafe symbols work too.
47 // [unsafe.Pointer] //@def("Pointer", UNSAFE)
48 // [unsafe.Slice] //@def("Slice", UNSAFE)
49 // [int] //@def("int", BUILTIN)
50 // [error] //@def("error", BUILTIN)
51 // [error.Error] //@def("Error", BUILTIN)
52 func _()