2012-12-12 16:43:54 +01:00
|
|
|
// errorcheck
|
|
|
|
|
2016-04-10 14:32:26 -07:00
|
|
|
// Copyright 2012 The Go Authors. All rights reserved.
|
2012-12-12 16:43:54 +01:00
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// Issue 3925: wrong line number for error message "missing key in map literal"
|
|
|
|
|
|
|
|
// also a test for correct line number in other malformed composite literals.
|
|
|
|
|
|
|
|
package foo
|
|
|
|
|
|
|
|
var _ = map[string]string{
|
|
|
|
"1": "2",
|
2013-06-20 08:21:14 +02:00
|
|
|
"3", "4", // ERROR "missing key|must have keys"
|
2012-12-12 16:43:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
var _ = []string{
|
|
|
|
"foo",
|
|
|
|
"bar",
|
2020-12-09 12:28:15 -08:00
|
|
|
20, // ERROR "cannot use|incompatible type|cannot convert"
|
2012-12-12 16:43:54 +01:00
|
|
|
}
|
|
|
|
|