| 1 |
// errorcheck |
| 2 |
|
| 3 |
// Copyright 2016 The Go Authors. All rights reserved. |
| 4 |
// Use of this source code is governed by a BSD-style |
| 5 |
// license that can be found in the LICENSE file. |
| 6 |
|
| 7 |
// The compiler was failing to correctly report an error when a dot |
| 8 |
// expression was used a struct literal key. |
| 9 |
|
| 10 |
package p |
| 11 |
|
| 12 |
type T struct { |
| 13 |
toInt map[string]int |
| 14 |
toString map[int]string |
| 15 |
} |
| 16 |
|
| 17 |
var t = T{ |
| 18 |
foo.toInt: make(map[string]int), // ERROR "field name" |
| 19 |
bar.toString: make(map[int]string), // ERROR "field name" |
| 20 |
} |