golang.org/x/tools/gopls@v0.15.3/internal/test/marker/testdata/zeroconfig/dynamicports.txt (about) 1 This test checks that the zero-config algorithm selects Views to cover first 2 class ports. 3 4 In this test, package a imports b, and b imports c. Package a contains files 5 constrained by go:build directives, package b contains files constrained by the 6 GOOS matching their file name, and package c is unconstrained. Various 7 assertions check that diagnostics and navigation work as expected. 8 9 -- go.mod -- 10 module golang.org/lsptests 11 12 -- a/a.go -- 13 package a 14 15 import "golang.org/lsptests/b" 16 17 var _ = b.F //@loc(F, "F") 18 19 -- a/linux64.go -- 20 //go:build (linux && amd64) 21 22 package a 23 24 import "golang.org/lsptests/b" 25 26 var _ int = 1<<32 -1 // OK on 64 bit platforms. Compare linux32.go below. 27 28 var ( 29 _ = b.LinuxOnly //@def("LinuxOnly", LinuxOnly) 30 _ = b.DarwinOnly //@diag("DarwinOnly", re"(undefined|declared)") 31 _ = b.WindowsOnly //@diag("WindowsOnly", re"(undefined|declared)") 32 ) 33 34 -- a/linux32.go -- 35 //go:build (linux && 386) 36 37 package a 38 39 import "golang.org/lsptests/b" 40 41 var _ int = 1<<32 -1 //@diag("1<<32", re"overflows") 42 43 var ( 44 _ = b.LinuxOnly //@def("LinuxOnly", LinuxOnly) 45 _ = b.DarwinOnly //@diag("DarwinOnly", re"(undefined|declared)") 46 _ = b.WindowsOnly //@diag("WindowsOnly", re"(undefined|declared)") 47 ) 48 49 -- a/darwin64.go -- 50 //go:build (darwin && amd64) 51 52 package a 53 54 import "golang.org/lsptests/b" 55 56 var ( 57 _ = b.LinuxOnly //@diag("LinuxOnly", re"(undefined|declared)") 58 _ = b.DarwinOnly //@def("DarwinOnly", DarwinOnly) 59 _ = b.WindowsOnly //@diag("WindowsOnly", re"(undefined|declared)") 60 ) 61 62 -- a/windows64.go -- 63 //go:build (windows && amd64) 64 65 package a 66 67 import "golang.org/lsptests/b" 68 69 var ( 70 _ = b.LinuxOnly //@diag("LinuxOnly", re"(undefined|declared)") 71 _ = b.DarwinOnly //@diag("DarwinOnly", re"(undefined|declared)") 72 _ = b.WindowsOnly //@def("WindowsOnly", WindowsOnly) 73 ) 74 75 -- b/b_other.go -- 76 //go:build !linux && !darwin && !windows 77 package b 78 79 func F() {} 80 81 -- b/b_linux.go -- 82 package b 83 84 import "golang.org/lsptests/c" 85 86 func F() { //@refs("F", "F", F) 87 x := c.Common //@diag("x", re"not used"),def("Common", Common) 88 } 89 90 const LinuxOnly = "darwin" //@loc(LinuxOnly, "LinuxOnly") 91 92 -- b/b_darwin.go -- 93 package b 94 95 import "golang.org/lsptests/c" 96 97 func F() { //@refs("F", "F", F) 98 x := c.Common //@diag("x", re"not used"),def("Common", Common) 99 } 100 101 const DarwinOnly = "darwin" //@loc(DarwinOnly, "DarwinOnly") 102 103 -- b/b_windows.go -- 104 package b 105 106 import "golang.org/lsptests/c" 107 108 func F() { //@refs("F", "F", F) 109 x := c.Common //@diag("x", re"not used"),def("Common", Common) 110 } 111 112 const WindowsOnly = "windows" //@loc(WindowsOnly, "WindowsOnly") 113 114 -- c/c.go -- 115 package c 116 117 const Common = 0 //@loc(Common, "Common") 118