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

     1  This test checks the formatting of the list of accessible methods.
     2  
     3  Observe that:
     4  - interface methods that appear in the syntax are not repeated
     5    in the method set of the type;
     6  - promoted methods of structs are shown;
     7  - receiver variables are correctly named;
     8  - receiver variables have a pointer type if appropriate;
     9  - only accessible methods are shown.
    10  
    11  -- go.mod --
    12  module example.com
    13  
    14  -- lib/lib.go --
    15  package lib
    16  
    17  type I interface {
    18  	A()
    19  	b()
    20  	J
    21  }
    22  
    23  type J interface { C() }
    24  
    25  type S struct { I }
    26  func (s S) A() {}
    27  func (s S) b() {}
    28  func (s *S) PA() {}
    29  func (s *S) pb() {}
    30  
    31  -- a/a.go --
    32  package a
    33  
    34  import "example.com/lib"
    35  
    36  var _ lib.I //@hover("I", "I", I)
    37  var _ lib.J //@hover("J", "J", J)
    38  var _ lib.S //@hover("S", "S", S)
    39  
    40  -- @I --
    41  ```go
    42  type I interface {
    43  	A()
    44  	b()
    45  	J
    46  }
    47  ```
    48  
    49  ```go
    50  func (lib.J) C()
    51  ```
    52  
    53  [`lib.I` on pkg.go.dev](https://pkg.go.dev/example.com/lib#I)
    54  -- @J --
    55  ```go
    56  type J interface{ C() }
    57  ```
    58  
    59  [`lib.J` on pkg.go.dev](https://pkg.go.dev/example.com/lib#J)
    60  -- @S --
    61  ```go
    62  type S struct{ I }
    63  ```
    64  
    65  ```go
    66  func (s lib.S) A()
    67  func (lib.J) C()
    68  func (s *lib.S) PA()
    69  ```
    70  
    71  [`lib.S` on pkg.go.dev](https://pkg.go.dev/example.com/lib#S)