github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/cmd/gofmt/testdata/composites.golden (about) 1 //gofmt -s 2 3 package P 4 5 type T struct { 6 x, y int 7 } 8 9 type T2 struct { 10 w, z int 11 } 12 13 var _ = [42]T{ 14 {}, 15 {1, 2}, 16 {3, 4}, 17 } 18 19 var _ = [...]T{ 20 {}, 21 {1, 2}, 22 {3, 4}, 23 } 24 25 var _ = []T{ 26 {}, 27 {1, 2}, 28 {3, 4}, 29 } 30 31 var _ = []T{ 32 {}, 33 10: {1, 2}, 34 20: {3, 4}, 35 } 36 37 var _ = []struct { 38 x, y int 39 }{ 40 {}, 41 10: {1, 2}, 42 20: {3, 4}, 43 } 44 45 var _ = []interface{}{ 46 T{}, 47 10: T{1, 2}, 48 20: T{3, 4}, 49 } 50 51 var _ = [][]int{ 52 {}, 53 {1, 2}, 54 {3, 4}, 55 } 56 57 var _ = [][]int{ 58 ([]int{}), 59 ([]int{1, 2}), 60 {3, 4}, 61 } 62 63 var _ = [][][]int{ 64 {}, 65 { 66 {}, 67 {0, 1, 2, 3}, 68 {4, 5}, 69 }, 70 } 71 72 var _ = map[string]T{ 73 "foo": {}, 74 "bar": {1, 2}, 75 "bal": {3, 4}, 76 } 77 78 var _ = map[string]struct { 79 x, y int 80 }{ 81 "foo": {}, 82 "bar": {1, 2}, 83 "bal": {3, 4}, 84 } 85 86 var _ = map[string]interface{}{ 87 "foo": T{}, 88 "bar": T{1, 2}, 89 "bal": T{3, 4}, 90 } 91 92 var _ = map[string][]int{ 93 "foo": {}, 94 "bar": {1, 2}, 95 "bal": {3, 4}, 96 } 97 98 var _ = map[string][]int{ 99 "foo": ([]int{}), 100 "bar": ([]int{1, 2}), 101 "bal": {3, 4}, 102 } 103 104 // from exp/4s/data.go 105 var pieces4 = []Piece{ 106 {0, 0, Point{4, 1}, []Point{{0, 0}, {1, 0}, {1, 0}, {1, 0}}, nil, nil}, 107 {1, 0, Point{1, 4}, []Point{{0, 0}, {0, 1}, {0, 1}, {0, 1}}, nil, nil}, 108 {2, 0, Point{4, 1}, []Point{{0, 0}, {1, 0}, {1, 0}, {1, 0}}, nil, nil}, 109 {3, 0, Point{1, 4}, []Point{{0, 0}, {0, 1}, {0, 1}, {0, 1}}, nil, nil}, 110 } 111 112 var _ = [42]*T{ 113 {}, 114 {1, 2}, 115 {3, 4}, 116 } 117 118 var _ = [...]*T{ 119 {}, 120 {1, 2}, 121 {3, 4}, 122 } 123 124 var _ = []*T{ 125 {}, 126 {1, 2}, 127 {3, 4}, 128 } 129 130 var _ = []*T{ 131 {}, 132 10: {1, 2}, 133 20: {3, 4}, 134 } 135 136 var _ = []*struct { 137 x, y int 138 }{ 139 {}, 140 10: {1, 2}, 141 20: {3, 4}, 142 } 143 144 var _ = []interface{}{ 145 &T{}, 146 10: &T{1, 2}, 147 20: &T{3, 4}, 148 } 149 150 var _ = []*[]int{ 151 {}, 152 {1, 2}, 153 {3, 4}, 154 } 155 156 var _ = []*[]int{ 157 (&[]int{}), 158 (&[]int{1, 2}), 159 {3, 4}, 160 } 161 162 var _ = []*[]*[]int{ 163 {}, 164 { 165 {}, 166 {0, 1, 2, 3}, 167 {4, 5}, 168 }, 169 } 170 171 var _ = map[string]*T{ 172 "foo": {}, 173 "bar": {1, 2}, 174 "bal": {3, 4}, 175 } 176 177 var _ = map[string]*struct { 178 x, y int 179 }{ 180 "foo": {}, 181 "bar": {1, 2}, 182 "bal": {3, 4}, 183 } 184 185 var _ = map[string]interface{}{ 186 "foo": &T{}, 187 "bar": &T{1, 2}, 188 "bal": &T{3, 4}, 189 } 190 191 var _ = map[string]*[]int{ 192 "foo": {}, 193 "bar": {1, 2}, 194 "bal": {3, 4}, 195 } 196 197 var _ = map[string]*[]int{ 198 "foo": (&[]int{}), 199 "bar": (&[]int{1, 2}), 200 "bal": {3, 4}, 201 } 202 203 var pieces4 = []*Piece{ 204 {0, 0, Point{4, 1}, []Point{{0, 0}, {1, 0}, {1, 0}, {1, 0}}, nil, nil}, 205 {1, 0, Point{1, 4}, []Point{{0, 0}, {0, 1}, {0, 1}, {0, 1}}, nil, nil}, 206 {2, 0, Point{4, 1}, []Point{{0, 0}, {1, 0}, {1, 0}, {1, 0}}, nil, nil}, 207 {3, 0, Point{1, 4}, []Point{{0, 0}, {0, 1}, {0, 1}, {0, 1}}, nil, nil}, 208 } 209 210 var _ = map[T]T2{ 211 {1, 2}: {3, 4}, 212 {5, 6}: {7, 8}, 213 } 214 215 var _ = map[*T]*T2{ 216 {1, 2}: {3, 4}, 217 {5, 6}: {7, 8}, 218 }