aboutsummaryrefslogtreecommitdiffstats
path: root/testdata/signature.go
diff options
context:
space:
mode:
authorTeddy Wing2023-05-20 21:31:05 +0200
committerTeddy Wing2023-05-20 21:31:05 +0200
commit3f4e4cf94596eaae380385d81f9a629fbee0eb7d (patch)
tree3b2bb755878c4cddd08aeeb89e6111457831140f /testdata/signature.go
parent856f21083e814176f9584cdb3d5df4cfdffc4834 (diff)
downloadgodefererr-3f4e4cf94596eaae380385d81f9a629fbee0eb7d.tar.bz2
Report when error declaration in signature is needed
While looking at the assignments in the `defer`, if we encounter an `error`-type assignment, emit a diagnostic if the error named in the lhs of the assignment is not present in the return signature's names. Not sure if this makes sense to me yet. I probably only want to report a problem for a non-declare assignment of an error value when the error type in the return signature is _not_ named at all.
Diffstat (limited to 'testdata/signature.go')
-rw-r--r--testdata/signature.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/testdata/signature.go b/testdata/signature.go
index 6fc15fc..d780240 100644
--- a/testdata/signature.go
+++ b/testdata/signature.go
@@ -2,7 +2,7 @@ package main
import "errors"
-func shouldDeclareErrInSignature() error { // want "return signature should be '(err error)'"
+func shouldDeclareErrInSignature() error { // want "return signature should be '\\(err error\\)'"
var err error // Should use variable declared in signature
err = nil