github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/tools/oracle/testdata/src/main/callgraph.go (about) 1 package main 2 3 // Tests of call-graph queries. 4 // See go.tools/oracle/oracle_test.go for explanation. 5 // See callgraph.golden for expected query results. 6 7 import "lib" 8 9 func A() {} 10 11 func B() {} 12 13 // call is not (yet) treated context-sensitively. 14 func call(f func()) { 15 f() 16 } 17 18 // nop *is* treated context-sensitively. 19 func nop() {} 20 21 func call2(f func()) { 22 f() 23 f() 24 } 25 26 func main() { 27 call(A) 28 call(B) 29 30 nop() 31 nop() 32 33 call2(func() { 34 // called twice from main.call2, 35 // but call2 is not context sensitive (yet). 36 }) 37 38 print("builtin") 39 _ = string("type conversion") 40 call(nil) 41 if false { 42 main() 43 } 44 var nilFunc func() 45 nilFunc() 46 var i interface { 47 f() 48 } 49 i.f() 50 51 lib.Func() 52 } 53 54 func deadcode() { 55 main() 56 } 57 58 // @callgraph callgraph-main "^" 59 60 // @callgraph callgraph-complete "nopos"