From 2b15aa63b7ef877573980c91658d6b79e6356409 Mon Sep 17 00:00:00 2001 From: David Symonds Date: Fri, 29 Aug 2014 08:56:35 +1000 Subject: [PATCH] go.tools/cmd/vet: don't panic on zero arg Log method calls. LGTM=r R=r CC=golang-codereviews https://golang.org/cl/134000043 --- cmd/vet/print.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/vet/print.go b/cmd/vet/print.go index 86958c71..3288d59d 100644 --- a/cmd/vet/print.go +++ b/cmd/vet/print.go @@ -496,7 +496,7 @@ func (f *File) checkPrint(call *ast.CallExpr, name string, firstArg int) { isLn := strings.HasSuffix(name, "ln") isF := strings.HasPrefix(name, "F") args := call.Args - if name == "Log" { + if name == "Log" && len(args) > 0 { // Special case: Don't complain about math.Log or cmplx.Log. // Not strictly necessary because the only complaint likely is for Log("%d") // but it feels wrong to check that math.Log is a good print function.