Debian Codegraph @

go/callgraph/rta/testdata/rtype.txtar

raw
1 -- go.mod --
2 module example.com
3 go 1.18
4
5 -- rtype.go --
6 package main
7
8 // Test of runtime types (types for which descriptors are needed).
9
10 func use(interface{})
11
12 type A byte // neither A nor byte are runtime types
13
14 type B struct{ x uint } // B and uint are runtime types, but not the struct
15
16 func main() {
17 var x int // not a runtime type
18 print(x)
19
20 var y string // runtime type due to interface conversion
21 use(y)
22
23 use(struct{ uint64 }{}) // struct is a runtime type
24
25 use(new(B)) // *B is a runtime type
26 }
27
28 // WANT:
29 //
30 // reachable main
31 // reachable use
32 //
33 // !rtype A
34 // !rtype struct{uint}
35 // rtype *B
36 // rtype B
37 // rtype string
38 // rtype struct{uint64}
39 // rtype uint
40 // rtype uint64
41 // !rtype int