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