Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/analyzer/defer_only.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,10 @@ func getAction(instr ssa.Instruction, targetTypes []any) action {
return actionReturned
}

if instr.Addr.Referrers() == nil {
return actionNoOp
}

if len(*instr.Addr.Referrers()) == 0 {
return actionNoOp
}
Expand Down Expand Up @@ -378,6 +382,10 @@ func checkDeferred(pass *analysis.Pass, instrs *[]ssa.Instruction, targetTypes [
return
}
case *ssa.Store:
if instr.Addr.Referrers() == nil {
return
}

if len(*instr.Addr.Referrers()) == 0 {
return
}
Expand Down