From 8102c9e6fe7e12d625718e362abb29bf1ecdb13c Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 25 May 2023 20:47:05 +0200 Subject: shouldDeclareErrInSignature: Add note about variable declaration line When I was first coming up with ideas for the project, I thought that this line is one I might need to report a diagnostic for, but since the compiler will catch it, we don't need to bother. --- testdata/signature.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'testdata') diff --git a/testdata/signature.go b/testdata/signature.go index cc9d72b..d6697c4 100644 --- a/testdata/signature.go +++ b/testdata/signature.go @@ -3,7 +3,10 @@ package main import "errors" func shouldDeclareErrInSignature() error { // want "return signature should use named error parameter err" - var err error // Should use variable declared in signature + // Should use variable declared in signature. We don't need to report this + // as if the variable is declared in the signature, a redeclaration causes + // a compile error. + var err error err = nil if err != nil { -- cgit v1.2.3