Debian Codegraph @

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

raw
1 This test checks hover results for built-in or standard library symbols.
2
3 It uses synopsis documentation as full documentation for some of these
4 built-ins varies across Go versions, where as it just so happens that the
5 synopsis does not.
6
7 In the future we may need to limit this test to the latest Go version to avoid
8 documentation churn.
9
10 -- settings.json --
11 {
12 "hoverKind": "SynopsisDocumentation"
13 }
14
15 -- go.mod --
16 module mod.com
17
18 go 1.18
19
20 -- std.go --
21 package std
22
23 import (
24 "fmt"
25 "go/types"
26 "sync"
27 )
28
29 func _() {
30 var err error //@loc(err, "err")
31 fmt.Printf("%v", err) //@def("err", err)
32
33 var _ string //@hover("string", "string", hoverstring)
34 _ = make([]int, 0) //@hover("make", "make", hovermake)
35
36 var mu sync.Mutex
37 mu.Lock() //@hover("Lock", "Lock", hoverLock)
38
39 var typ *types.Named //@hover("types", "types", hoverTypes)
40 typ.Obj().Name() //@hover("Name", "Name", hoverName)
41 }
42 -- @hoverLock --
43 ```go
44 func (m *sync.Mutex) Lock()
45 ```
46
47 ---
48
49 Lock locks m.
50
51
52 ---
53
54 [`(sync.Mutex).Lock` on pkg.go.dev](https://pkg.go.dev/sync#Mutex.Lock)
55 -- @hoverName --
56 ```go
57 func (obj *types.object) Name() string // through types.object
58 ```
59
60 ---
61
62 Name returns the object's (package-local, unqualified) name.
63
64
65 ---
66
67 [`(types.TypeName).Name` on pkg.go.dev](https://pkg.go.dev/go/types#TypeName.Name)
68 -- @hoverTypes --
69 ```go
70 package types
71 ```
72
73 ---
74
75 Package types declares the data types and implements the algorithms for type-checking of Go packages.
76
77
78 ---
79
80 [`types` on pkg.go.dev](https://pkg.go.dev/go/types)
81 -- @hovermake --
82 ```go
83 func make(t Type, size ...int) Type
84 ```
85
86 ---
87
88 The make built-in function allocates and initializes an object of type slice, map, or chan (only).
89
90
91 ---
92
93 [`make` on pkg.go.dev](https://pkg.go.dev/builtin#make)
94 -- @hoverstring --
95 ```go
96 type string string
97 ```
98
99 ---
100
101 string is the set of all strings of 8-bit bytes, conventionally but not necessarily representing UTF-8-encoded text.
102
103
104 ---
105
106 [`string` on pkg.go.dev](https://pkg.go.dev/builtin#string)