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

     1  This test checks definition and hover over imports.
     2  
     3  Requires go1.19+ for the new go/doc/comment package.
     4  
     5  -- flags --
     6  -min_go=go1.19
     7  
     8  -- go.mod --
     9  module mod.com
    10  
    11  go 1.18
    12  -- foo/foo.go --
    13  package foo
    14  
    15  type Foo struct{}
    16  
    17  // DoFoo does foo.
    18  func DoFoo() {} //@loc(DoFoo, "DoFoo")
    19  -- bar/bar.go --
    20  package bar
    21  
    22  import (
    23  	myFoo "mod.com/foo" //@loc(myFoo, "myFoo")
    24  )
    25  
    26  var _ *myFoo.Foo //@def("myFoo", myFoo),hover("myFoo", "myFoo", myFoo)
    27  -- bar/dotimport.go --
    28  package bar
    29  
    30  import . "mod.com/foo"
    31  
    32  func _() {
    33  	// variable of type foo.Foo
    34  	var _ Foo //@hover("_", "_", FooVar)
    35  
    36  	DoFoo() //@hover("DoFoo", "DoFoo", DoFoo)
    37  }
    38  -- @DoFoo --
    39  ```go
    40  func DoFoo()
    41  ```
    42  
    43  DoFoo does foo.
    44  
    45  
    46  [`foo.DoFoo` on pkg.go.dev](https://pkg.go.dev/mod.com/foo#DoFoo)
    47  -- @FooVar --
    48  ```go
    49  var _ Foo
    50  ```
    51  
    52  variable of type foo.Foo
    53  -- @myFoo --
    54  ```go
    55  package myFoo ("mod.com/foo")
    56  ```
    57  
    58  [`myFoo` on pkg.go.dev](https://pkg.go.dev/mod.com/foo)