Source file
test/indirect1.go
1
2
3
4
5
6
7
8
9
10 package main
11
12 var m0 map[string]int
13 var m1 *map[string]int
14 var m2 *map[string]int = &m0
15 var m3 map[string]int = map[string]int{"a": 1}
16 var m4 *map[string]int = &m3
17
18 var s0 string
19 var s1 *string
20 var s2 *string = &s0
21 var s3 string = "a"
22 var s4 *string = &s3
23
24 var a0 [10]int
25 var a1 *[10]int
26 var a2 *[10]int = &a0
27
28 var b0 []int
29 var b1 *[]int
30 var b2 *[]int = &b0
31 var b3 []int = []int{1, 2, 3}
32 var b4 *[]int = &b3
33
34 func f() {
35
36
37
38
39 x :=
40 len(m0)+
41 len(m1)+
42 len(m2)+
43 len(m3)+
44 len(m4)+
45
46 len(s0)+
47 len(s1)+
48 len(s2)+
49 len(s3)+
50 len(s4)+
51
52 len(a0)+
53 len(a1)+
54 len(a2)+
55
56 cap(a0)+
57 cap(a1)+
58 cap(a2)+
59
60 len(b0)+
61 len(b1)+
62 len(b2)+
63 len(b3)+
64 len(b4)+
65
66 cap(b0)+
67 cap(b1)+
68 cap(b2)+
69 cap(b3)+
70 cap(b4)
71 _ = x
72 }
73
View as plain text