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

     1  This test checks that gopls works with nested modules, including multiple
     2  nested modules.
     3  
     4  -- main.go --
     5  package main
     6  
     7  import "fmt"
     8  
     9  func main() {
    10  	fmt.Println(mainMsg) //@def("mainMsg", mainMsg)
    11  	fmt.Println(undef) //@diag("undef", re"undefined|undeclared")
    12  }
    13  -- main2.go --
    14  package main
    15  
    16  const mainMsg = "main" //@loc(mainMsg, "mainMsg")
    17  
    18  -- mod1/go.mod --
    19  module golang.org/lsptests/mod1
    20  
    21  go 1.20
    22  
    23  -- mod1/a/a.go --
    24  package a
    25  
    26  import (
    27  	"fmt"
    28  	"golang.org/lsptests/mod1/b"
    29  )
    30  
    31  func _() {
    32  	fmt.Println(b.Msg) //@def("Msg", Msg)
    33  	fmt.Println(undef) //@diag("undef", re"undefined|undeclared")
    34  }
    35  
    36  -- mod1/b/b.go --
    37  package b
    38  
    39  const Msg = "1" //@loc(Msg, "Msg")
    40  
    41  -- mod2/go.mod --
    42  module golang.org/lsptests/mod2
    43  
    44  require golang.org/lsptests/mod1 v0.0.1
    45  
    46  replace golang.org/lsptests/mod1 => ../mod1
    47  
    48  go 1.20
    49  
    50  -- mod2/c/c.go --
    51  package c
    52  
    53  import (
    54  	"fmt"
    55  	"golang.org/lsptests/mod1/b"
    56  )
    57  
    58  func _() {
    59  	fmt.Println(b.Msg) //@def("Msg", Msg)
    60  	fmt.Println(undef) //@diag("undef", re"undefined|undeclared")
    61  }