.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.1.1 / unused / testdata / src / fields / fields.go
1 // Test of field usage detection
2
3 package pkg
4
5 type t1 struct { // used
6         f11 int // used
7         f12 int // used
8 }
9 type t2 struct { // used
10         f21 int // used
11         f22 int // used
12 }
13 type t3 struct { // used
14         f31 t4 // used
15 }
16 type t4 struct { // used
17         f41 int // used
18 }
19 type t5 struct { // used
20         f51 int // used
21 }
22 type t6 struct { // used
23         f61 int // used
24 }
25 type t7 struct { // used
26         f71 int // used
27 }
28 type m1 map[string]t7 // used
29 type t8 struct {      // used
30         f81 int // used
31 }
32 type t9 struct { // used
33         f91 int // used
34 }
35 type t10 struct { // used
36         f101 int // used
37 }
38 type t11 struct { // used
39         f111 int // used
40 }
41 type s1 []t11     // used
42 type t12 struct { // used
43         f121 int // used
44 }
45 type s2 []t12     // used
46 type t13 struct { // used
47         f131 int // used
48 }
49 type t14 struct { // used
50         f141 int // used
51 }
52 type a1 [1]t14    // used
53 type t15 struct { // used
54         f151 int // used
55 }
56 type a2 [1]t15    // used
57 type t16 struct { // used
58         f161 int // used
59 }
60 type t17 struct { // unused
61         f171 int
62         f172 int
63 }
64 type t18 struct { // used
65         f181 int // used
66         f182 int // unused
67         f183 int // unused
68 }
69
70 type t19 struct { // used
71         f191 int // used
72 }
73 type m2 map[string]t19 // used
74
75 type t20 struct { // used
76         f201 int // used
77 }
78 type m3 map[string]t20 // used
79
80 type t21 struct { // used
81         f211 int // unused
82         f212 int // used
83 }
84 type t22 struct { // unused
85         f221 int
86         f222 int
87 }
88
89 func foo() { // used
90         _ = t10{1}
91         _ = t21{f212: 1}
92         _ = []t1{{1, 2}}
93         _ = t2{1, 2}
94         _ = []struct {
95                 a int // used
96         }{{1}}
97
98         // XXX
99         // _ = []struct{ foo struct{ bar int } }{{struct{ bar int }{1}}}
100
101         _ = []t1{t1{1, 2}}
102         _ = []t3{{t4{1}}}
103         _ = map[string]t5{"a": {1}}
104         _ = map[t6]string{{1}: "a"}
105         _ = m1{"a": {1}}
106         _ = map[t8]t8{{}: {1}}
107         _ = map[t9]t9{{1}: {}}
108         _ = s1{{1}}
109         _ = s2{2: {1}}
110         _ = [...]t13{{1}}
111         _ = a1{{1}}
112         _ = a2{0: {1}}
113         _ = map[[1]t16]int{{{1}}: 1}
114         y := struct {
115                 x int // used
116         }{}
117         _ = y
118         _ = t18{f181: 1}
119         _ = []m2{{"a": {1}}}
120         _ = [][]m3{{{"a": {1}}}}
121 }
122
123 func init() { foo() } // used
124
125 func superUnused() { // unused
126         var _ struct {
127                 x int
128         }
129 }