cmd/vet: don't complain about Error()
Fixes #4598.
R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/7102050
diff --git a/src/cmd/vet/print.go b/src/cmd/vet/print.go
index cda5fcd..a402d3d 100644
--- a/src/cmd/vet/print.go
+++ b/src/cmd/vet/print.go
@@ -253,7 +253,8 @@
}
}
if len(args) <= skip {
- if *verbose && !isLn {
+ // TODO: check that the receiver of Error() is of type error.
+ if !isLn && name != "Error" {
f.Badf(call.Pos(), "no args in %s call", name)
}
return
@@ -299,6 +300,8 @@
f.Warnf(0, "%s", "hello", 3) // ERROR "wrong number of args in Warnf call"
f.Warnf(0, "%r", "hello") // ERROR "unrecognized printf verb"
f.Warnf(0, "%#s", "hello") // ERROR "unrecognized printf flag"
+ var e error
+ fmt.Println(e.Error()) // correct, used to trigger "no args in Error call"
}
// printf is used by the test.