aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2023-05-25 19:00:26 +0200
committerTeddy Wing2023-05-25 19:00:26 +0200
commitc15e27166dfb8ef1c94cd8c87ab41edb4e98300f (patch)
tree78ecb35e18bfb49a7c3628fd3d0d8720f1f100ab
parent1fdc8a5d6296dbbcfe4b09e12e39484bbda82265 (diff)
downloadgodefererr-c15e27166dfb8ef1c94cd8c87ab41edb4e98300f.tar.bz2
checkFunctions: Keep `continue` in return value loop
Looks like the return value type is always an `*ast.Ident`. Use `continue` instead of `return true` to be more tolerant of unexpected values.
-rw-r--r--defererr.go3
-rw-r--r--testdata/signature.go4
2 files changed, 4 insertions, 3 deletions
diff --git a/defererr.go b/defererr.go
index 126f824..96c5569 100644
--- a/defererr.go
+++ b/defererr.go
@@ -81,9 +81,6 @@ func checkFunctions(pass *analysis.Pass, node ast.Node) {
for i, returnVal := range funcDecl.Type.Results.List {
returnIdent, ok := returnVal.Type.(*ast.Ident)
if !ok {
- // TODO: Do we need to `return true` here? Does this check
- // mean that variables are not declared in the return
- // signature?
continue
}
diff --git a/testdata/signature.go b/testdata/signature.go
index 2606c22..0da2bb0 100644
--- a/testdata/signature.go
+++ b/testdata/signature.go
@@ -102,3 +102,7 @@ func good() (err error) {
return err
}
+
+func noErrorInReturn() string {
+ return "test"
+}