Debian Codegraph @

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

raw
1 This test checks hovering over doc links in comments.
2
3 -- go.mod --
4 module mod.com
5
6 go 1.20
7
8 -- a.go --
9 package p
10
11 import (
12 "unsafe"
13
14 "mod.com/util" //@hover(`"mod.com/util"`, `"mod.com/util"`, strconv)
15 )
16
17 // [NumberBase] is the base to use for number parsing. //@hover("NumberBase", "NumberBase", NumberBase),hover(re"()NumberBase", "NumberBase", NumberBase),hover(re"NumberBase()", "NumberBase", NumberBase)
18 const NumberBase = 10
19
20 // [Conv] converts s to an int. //@hover("Conv", "Conv", Conv)
21 func Conv(s string) int {
22 // [util.ParseInt] parses s and returns the integer corresponding to it. //@hover("util", "util", util),hover("ParseInt", "ParseInt", strconvParseInt)
23 // [NumberBase] is the base to use for number parsing.
24 i, _ := util.ParseInt(s, NumberBase, 64)
25 return int(i)
26 }
27
28 // UnsafeConv converts s to a byte slice using [unsafe.Pointer]. hover("Pointer", "Pointer", unsafePointer)
29 func UnsafeConv(s string) []byte {
30 p := unsafe.StringData(s)
31 b := unsafe.Slice(p, len(s))
32 return b
33 }
34
35 -- util/conv.go --
36 // Package util provides utility functions.
37 package util
38
39 import "strconv"
40
41 // ParseInt interprets a string s in the given base (0, 2 to 36) and
42 // bit size (0 to 64) and returns the corresponding value i.
43 func ParseInt(s string, base int, bitSize int) (int64, error) {
44 return strconv.ParseInt(s, base, bitSize)
45 }
46
47 -- @Conv --
48 ```go
49 func Conv(s string) int
50 ```
51
52 ---
53
54 [Conv](file://$WORKDIR/a.go#13,6) converts s to an int. //@hover("Conv", "Conv", Conv)
55
56
57 ---
58
59 [`p.Conv` on pkg.go.dev](https://pkg.go.dev/mod.com#Conv)
60 -- @NumberBase --
61 ```go
62 const NumberBase untyped int = 10
63 ```
64
65 ---
66
67 [NumberBase](file://$WORKDIR/a.go#10,7) is the base to use for number parsing. //@hover("NumberBase", "NumberBase", NumberBase),hover(re"()NumberBase", "NumberBase", NumberBase),hover(re"NumberBase()", "NumberBase", NumberBase)
68
69
70 ---
71
72 [`p.NumberBase` on pkg.go.dev](https://pkg.go.dev/mod.com#NumberBase)
73 -- @strconv --
74 ```go
75 package util
76 ```
77
78 ---
79
80 Package util provides utility functions.
81 -- @strconvParseInt --
82 ```go
83 func ParseInt(s string, base int, bitSize int) (int64, error)
84 ```
85
86 ---
87
88 ParseInt interprets a string s in the given base (0, 2 to 36) and bit size (0 to 64) and returns the corresponding value i.
89
90
91 ---
92
93 [`util.ParseInt` on pkg.go.dev](https://pkg.go.dev/mod.com/util#ParseInt)
94 -- @util --
95 ```go
96 package util
97 ```
98
99 ---
100
101 Package util provides utility functions.