aboutsummaryrefslogtreecommitdiffstats
path: root/defererr.go
diff options
context:
space:
mode:
Diffstat (limited to 'defererr.go')
-rw-r--r--defererr.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/defererr.go b/defererr.go
index 31529b1..87697a3 100644
--- a/defererr.go
+++ b/defererr.go
@@ -92,6 +92,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
// TODO: Get type of Lhs, check if "error"
// If "error", then ensure error return is declared in signature
+ deferAssignsError := false
for _, variable := range assignStmt.Lhs {
ident, ok := variable.(*ast.Ident)
if !ok {
@@ -123,8 +124,18 @@ func run(pass *analysis.Pass) (interface{}, error) {
fmt.Printf("type.type.obj: %#v\n", named.Obj())
fmt.Printf("type.type.obj: %#v\n", named.Obj().Name())
+
+ if named.Obj().Name() == "error" {
+ deferAssignsError = true
+ }
+ }
+
+ if !deferAssignsError {
+ return true
}
+ // TODO: Check that funcDecl declares error in signature (check before ast.Inspect on function body, report here)
+
return true
},
)