-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
currently defermodafterreturn uses ast.Inspect, but doesn't really keep track of the stack of scopes a defer is in when running the analysis. this could lead to false positives where a defer 3 levels deep could potentially ignore variables 2 levels deep
package main
import "fmt"
func run() error {
var err error
defer func() {
defer func() {
var err error
defer func() {
err = nil
}()
fmt.Println(err)
}()
}()
return err
}main.go:10:10 function literal in defer assigns to (err) a non-named return in parent function
defer func() {
err = nil
}()
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels