github.com/v2fly/tools@v0.100.0/internal/lsp/testdata/semantic/a.go (about) 1 package semantictokens //@ semantic("") 2 3 import ( 4 _ "encoding/utf8" 5 utf "encoding/utf8" 6 "fmt" //@ semantic("fmt") 7 . "fmt" 8 "unicode/utf8" 9 ) 10 11 var ( 12 a = fmt.Print 13 b []string = []string{"foo"} 14 c1 chan int 15 c2 <-chan int 16 c3 = make([]chan<- int) 17 b = A{X: 23} 18 m map[bool][3]*float64 19 ) 20 21 const ( 22 xx F = iota 23 yy = xx + 3 24 zz = "" 25 ww = "not " + zz 26 ) 27 28 type A struct { 29 X int `foof` 30 } 31 type B interface { 32 A 33 sad(int) bool 34 } 35 36 type F int 37 38 func (a *A) f() bool { 39 var z string 40 x := "foo" 41 a(x) 42 y := "bar" + x 43 switch z { 44 case "xx": 45 default: 46 } 47 select { 48 case z := <-c3[0]: 49 default: 50 } 51 for k, v := range m { 52 return (!k) && v[0] == nil 53 } 54 c2 <- A.X 55 w := b[4:] 56 j := len(x) 57 j-- 58 return true 59 } 60 61 func g(vv ...interface{}) { 62 ff := func() {} 63 defer ff() 64 go utf.RuneCount("") 65 go utf8.RuneCount(vv.(string)) 66 if true { 67 } else { 68 } 69 Never: 70 for i := 0; i < 10; { 71 break Never 72 } 73 _, ok := vv[0].(A) 74 if !ok { 75 switch x := vv[0].(type) { 76 } 77 } 78 }