github.com/golangci/go-tools@v0.0.0-20190318060251-af6baa5dc196/callgraph/rta/testdata/func.go (about) 1 //+build ignore 2 3 package main 4 5 // Test of dynamic function calls. 6 // No interfaces, so no runtime/reflect types. 7 8 func A1() { 9 A2(0) 10 } 11 12 func A2(int) {} // not address-taken 13 14 func B() {} // unreachable 15 16 var ( 17 C = func(int) {} 18 D = func(int) {} 19 ) 20 21 func main() { 22 A1() 23 24 pfn := C 25 pfn(0) // calls C and D but not A2 (same sig but not address-taken) 26 } 27 28 // WANT: 29 // Dynamic calls 30 // main --> init$1 31 // main --> init$2 32 // Reachable functions 33 // A1 34 // A2 35 // init$1 36 // init$2 37 // Reflect types