golang.org/x/tools/gopls@v0.15.3/internal/test/marker/testdata/callhierarchy/callhierarchy.txt (about) 1 This test checks call hierarchy queries. 2 3 -ignore_extra_diags due to the initialization cycle. 4 5 -- flags -- 6 -ignore_extra_diags 7 8 -- go.mod -- 9 module golang.org/lsptests/callhierarchy 10 11 -- incoming/incoming.go -- 12 package incoming 13 14 import "golang.org/lsptests/callhierarchy" 15 16 // A is exported to test incoming calls across packages 17 func A() { //@loc(incomingA, "A") 18 callhierarchy.D() 19 } 20 21 -- outgoing/outgoing.go -- 22 package outgoing 23 24 // B is exported to test outgoing calls across packages 25 func B() { //@loc(outgoingB, "B") 26 } 27 28 -- hierarchy.go -- 29 package callhierarchy 30 31 import "golang.org/lsptests/callhierarchy/outgoing" 32 33 func a() { //@loc(hierarchyA, "a") 34 D() 35 } 36 37 func b() { //@loc(hierarchyB, "b") 38 D() 39 } 40 41 // C is an exported function 42 func C() { //@loc(hierarchyC, "C") 43 D() 44 D() 45 } 46 47 // To test hierarchy across function literals 48 var x = func() { //@loc(hierarchyLiteral, "func"),loc(hierarchyLiteralOut, "x") 49 D() 50 } 51 52 // D is exported to test incoming/outgoing calls across packages 53 func D() { //@loc(hierarchyD, "D"),incomingcalls(hierarchyD, hierarchyA, hierarchyB, hierarchyC, hierarchyLiteral, incomingA),outgoingcalls(hierarchyD, hierarchyE, hierarchyF, hierarchyG, hierarchyLiteralOut, outgoingB, hierarchyFoo, hierarchyH, hierarchyI, hierarchyJ, hierarchyK) 54 e() 55 x() 56 F() 57 outgoing.B() 58 foo := func() {} //@loc(hierarchyFoo, "foo"),incomingcalls(hierarchyFoo, hierarchyD),outgoingcalls(hierarchyFoo) 59 foo() 60 61 func() { 62 g() 63 }() 64 65 var i Interface = impl{} 66 i.H() 67 i.I() 68 69 s := Struct{} 70 s.J() 71 s.K() 72 } 73 74 func e() {} //@loc(hierarchyE, "e") 75 76 // F is an exported function 77 func F() {} //@loc(hierarchyF, "F") 78 79 func g() {} //@loc(hierarchyG, "g") 80 81 type Interface interface { 82 H() //@loc(hierarchyH, "H") 83 I() //@loc(hierarchyI, "I") 84 } 85 86 type impl struct{} 87 88 func (i impl) H() {} 89 func (i impl) I() {} 90 91 type Struct struct { 92 J func() //@loc(hierarchyJ, "J") 93 K func() //@loc(hierarchyK, "K") 94 }