| -- Lock-hoverdef -- |
| ```go |
| func (*sync.Mutex).Lock() |
| ``` |
| |
| Lock locks m\. |
| |
| [`(sync.Mutex).Lock` on pkg.go.dev](https://pkg.go.dev/sync?utm_source=gopls#Mutex.Lock) |
| -- Name-hoverdef -- |
| ```go |
| func (*types.object).Name() string |
| ``` |
| |
| Name returns the object\'s \(package\-local, unqualified\) name\. |
| |
| [`(types.TypeName).Name` on pkg.go.dev](https://pkg.go.dev/go/types?utm_source=gopls#TypeName.Name) |
| -- Random-definition -- |
| godef/a/random.go:3:6-12: defined here as ```go |
| func Random() int |
| ``` |
| |
| [`a.Random` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Random) |
| -- Random-definition-json -- |
| { |
| "span": { |
| "uri": "file://godef/a/random.go", |
| "start": { |
| "line": 3, |
| "column": 6, |
| "offset": 16 |
| }, |
| "end": { |
| "line": 3, |
| "column": 12, |
| "offset": 22 |
| } |
| }, |
| "description": "```go\nfunc Random() int\n```\n\n[`a.Random` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Random)" |
| } |
| |
| -- Random-hoverdef -- |
| ```go |
| func Random() int |
| ``` |
| |
| [`a.Random` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Random) |
| -- Random2-definition -- |
| godef/a/random.go:8:6-13: defined here as ```go |
| func Random2(y int) int |
| ``` |
| |
| [`a.Random2` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Random2) |
| -- Random2-definition-json -- |
| { |
| "span": { |
| "uri": "file://godef/a/random.go", |
| "start": { |
| "line": 8, |
| "column": 6, |
| "offset": 71 |
| }, |
| "end": { |
| "line": 8, |
| "column": 13, |
| "offset": 78 |
| } |
| }, |
| "description": "```go\nfunc Random2(y int) int\n```\n\n[`a.Random2` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Random2)" |
| } |
| |
| -- Random2-hoverdef -- |
| ```go |
| func Random2(y int) int |
| ``` |
| |
| [`a.Random2` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Random2) |
| -- aPackage-hoverdef -- |
| Package a is a package for testing go to definition\. |
| -- declBlockA-hoverdef -- |
| ```go |
| type a struct { |
| x string |
| } |
| ``` |
| |
| 1st type declaration block |
| -- declBlockB-hoverdef -- |
| ```go |
| type b struct{} |
| ``` |
| |
| b has a comment |
| -- declBlockC-hoverdef -- |
| ```go |
| type c struct { |
| f string |
| } |
| ``` |
| |
| c is a struct |
| -- declBlockD-hoverdef -- |
| ```go |
| type d string |
| ``` |
| |
| 3rd type declaration block |
| -- declBlockE-hoverdef -- |
| ```go |
| type e struct { |
| f float64 |
| } |
| ``` |
| |
| e has a comment |
| -- err-definition -- |
| godef/a/a.go:33:6-9: defined here as ```go |
| var err error |
| ``` |
| |
| \@err |
| -- err-definition-json -- |
| { |
| "span": { |
| "uri": "file://godef/a/a.go", |
| "start": { |
| "line": 33, |
| "column": 6, |
| "offset": 612 |
| }, |
| "end": { |
| "line": 33, |
| "column": 9, |
| "offset": 615 |
| } |
| }, |
| "description": "```go\nvar err error\n```\n\n\\@err" |
| } |
| |
| -- err-hoverdef -- |
| ```go |
| var err error |
| ``` |
| |
| \@err |
| -- g-hoverdef -- |
| ```go |
| const g untyped int = 1 |
| ``` |
| |
| When I hover on g, I should see this comment\. |
| -- h-hoverdef -- |
| ```go |
| const h untyped int = 2 |
| ``` |
| |
| Constant block\. |
| -- make-hoverdef -- |
| ```go |
| func make(t Type, size ...int) Type |
| ``` |
| |
| The make built\-in function allocates and initializes an object of type slice, map, or chan \(only\)\. |
| |
| [`make` on pkg.go.dev](https://pkg.go.dev/builtin?utm_source=gopls#make) |
| -- string-hoverdef -- |
| ```go |
| type string string |
| ``` |
| |
| string is the set of all strings of 8\-bit bytes, conventionally but not necessarily representing UTF\-8\-encoded text\. |
| |
| [`string` on pkg.go.dev](https://pkg.go.dev/builtin?utm_source=gopls#string) |
| -- typesImport-hoverdef -- |
| ```go |
| package types ("go/types") |
| ``` |
| |
| [`types` on pkg.go.dev](https://pkg.go.dev/go/types?utm_source=gopls) |
| -- x-hoverdef -- |
| ```go |
| var x string |
| ``` |
| |
| x is a variable\. |
| -- z-hoverdef -- |
| ```go |
| var z string |
| ``` |
| |
| z is a variable too\. |