diff options
author | Teddy Wing | 2023-05-25 20:47:05 +0200 |
---|---|---|
committer | Teddy Wing | 2023-05-25 20:47:05 +0200 |
commit | 8102c9e6fe7e12d625718e362abb29bf1ecdb13c (patch) | |
tree | 4d4017f68e33517d06aa903af28b4f6c2179144b | |
parent | 8bcef611f794272203e05e207259ac8d45d558fb (diff) | |
download | godefererr-8102c9e6fe7e12d625718e362abb29bf1ecdb13c.tar.bz2 |
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.
-rw-r--r-- | testdata/signature.go | 5 |
1 files changed, 4 insertions, 1 deletions
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 { |