golang.org/x/tools/gopls@v0.15.3/internal/test/marker/testdata/hover/std.txt (about)

     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  Requires go1.19+ for the new go/doc/comment package.
    11  
    12  -- flags --
    13  -min_go=go1.19
    14  
    15  -- settings.json --
    16  {
    17  	"hoverKind": "SynopsisDocumentation"
    18  }
    19  
    20  -- go.mod --
    21  module mod.com
    22  
    23  go 1.18
    24  
    25  -- std.go --
    26  package std
    27  
    28  import (
    29  	"fmt"
    30  	"go/types"
    31  	"sync"
    32  )
    33  
    34  func _() {
    35  	var err error         //@loc(err, "err")
    36  	fmt.Printf("%v", err) //@def("err", err)
    37  
    38  	var _ string       //@hover("string", "string", hoverstring)
    39  	_ = make([]int, 0) //@hover("make", "make", hovermake)
    40  
    41  	var mu sync.Mutex
    42  	mu.Lock() //@hover("Lock", "Lock", hoverLock)
    43  
    44  	var typ *types.Named //@hover("types", "types", hoverTypes)
    45  	typ.Obj().Name()     //@hover("Name", "Name", hoverName)
    46  }
    47  -- @hoverLock --
    48  ```go
    49  func (m *sync.Mutex) Lock()
    50  ```
    51  
    52  Lock locks m.
    53  
    54  
    55  [`(sync.Mutex).Lock` on pkg.go.dev](https://pkg.go.dev/sync#Mutex.Lock)
    56  -- @hoverName --
    57  ```go
    58  func (obj *types.object) Name() string
    59  ```
    60  
    61  Name returns the object's (package-local, unqualified) name.
    62  
    63  
    64  [`(types.TypeName).Name` on pkg.go.dev](https://pkg.go.dev/go/types#TypeName.Name)
    65  -- @hoverTypes --
    66  ```go
    67  package types ("go/types")
    68  ```
    69  
    70  [`types` on pkg.go.dev](https://pkg.go.dev/go/types)
    71  -- @hovermake --
    72  ```go
    73  func make(t Type, size ...int) Type
    74  ```
    75  
    76  The make built-in function allocates and initializes an object of type slice, map, or chan (only).
    77  
    78  
    79  [`make` on pkg.go.dev](https://pkg.go.dev/builtin#make)
    80  -- @hoverstring --
    81  ```go
    82  type string string
    83  ```
    84  
    85  string is the set of all strings of 8-bit bytes, conventionally but not necessarily representing UTF-8-encoded text.
    86  
    87  
    88  [`string` on pkg.go.dev](https://pkg.go.dev/builtin#string)