aboutsummaryrefslogtreecommitdiffstats
path: root/defererr.go
diff options
context:
space:
mode:
Diffstat (limited to 'defererr.go')
-rw-r--r--defererr.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/defererr.go b/defererr.go
index 498708c..226e52b 100644
--- a/defererr.go
+++ b/defererr.go
@@ -16,10 +16,11 @@ var Analyzer = &analysis.Analyzer{
}
func run(pass *analysis.Pass) (interface{}, error) {
- // TODO: Find defer closure
- // Does it set error defined in outer scope?
- // Does outer scope declare error variable in signature?
- // Is err variable returned after closure?
+ // Look at each function and check if it returns an error.
+ // If so, look for a defer inside the function.
+ // If a captured error variable is defined in the defer's closure, ensure
+ // that the variable is declared in the function's signature, and that any
+ // returns after the defer closure use the assigned error variable.
for _, file := range pass.Files {
checkFunctions(pass, file)