mirror of
https://github.com/golang/go
synced 2024-11-17 21:34:49 -07:00
83bfed916b
When we have a typed nil, we already say so; thus it is sufficient to use "nil" in all the other cases. This is closer to (1.17) compiler behavior. In cases where the 1.17 compiler prints "untyped nil" (e.g., wrong uses of "copy"), we already print a different message. We can do better in those cases as well; will be addressed in a separate CL (see #49735). Fixes #48852. Change-Id: I9a7a72e0f99185b00f80040c5510a693b1ea80f6 Reviewed-on: https://go-review.googlesource.com/c/go/+/366276 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
15 lines
426 B
Go
15 lines
426 B
Go
// errorcheck
|
|
|
|
// Copyright 2013 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package main
|
|
|
|
func main() {
|
|
_ = nil // ERROR "use of untyped nil"
|
|
_, _ = nil, 1 // ERROR "use of untyped nil"
|
|
_, _ = 1, nil // ERROR "use of untyped nil"
|
|
_ = append(nil, 1, 2, 3) // ERROR "untyped nil|nil"
|
|
}
|