Skip to content

Commit 1b5fadb

Browse files
committed
fix: pgx interface method call detection
1 parent 2e93d45 commit 1b5fadb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pkg/analyzer/defer_only.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,17 @@ func getAction(instr ssa.Instruction, targetTypes []any) action {
260260

261261
return actionUnvaluedDefer
262262
case *ssa.Call:
263+
if instr.Call.Method != nil {
264+
receiverType := instr.Call.Value.Type()
265+
if isTargetType(receiverType, targetTypes) {
266+
if instr.Call.Method.Name() == closeMethod {
267+
return actionClosed
268+
}
269+
270+
return actionNoOp
271+
}
272+
}
273+
263274
if instr.Call.Value == nil {
264275
return actionUnvaluedCall
265276
}

0 commit comments

Comments
 (0)