diff options
author | Teddy Wing | 2023-05-20 21:31:05 +0200 |
---|---|---|
committer | Teddy Wing | 2023-05-20 21:31:05 +0200 |
commit | 3f4e4cf94596eaae380385d81f9a629fbee0eb7d (patch) | |
tree | 3b2bb755878c4cddd08aeeb89e6111457831140f /testdata | |
parent | 856f21083e814176f9584cdb3d5df4cfdffc4834 (diff) | |
download | godefererr-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')
-rw-r--r-- | testdata/signature.go | 2 |
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 |