Commit 15606dd
committed
pkg/analyzer: fix pgx interface method call detection
Fix issue #36 where the linter failed to detect missing Close() calls
when methods like rows.Next() or rows.Err() were called on pgx.Rows.
The root cause was that interface method calls (SSA "invoke mode") were
not handled in getAction(). For interface calls, instr.Call.Method is
set and StaticCallee() returns nil, causing the code to incorrectly
return actionPassed instead of continuing to check for Close().
The fix adds handling for invoke mode at the start of the *ssa.Call
case: check if instr.Call.Method is set, verify the receiver is a
target type, and return actionClosed for Close() or actionNoOp for
other methods like Next(), Err(), and Scan().1 parent 3ec3977 commit 15606dd
File tree
360 files changed
+55692
-26383
lines changed- pkg/analyzer
- testdata
- pgx
- vendor
- github.com/jackc
- pgservicefile
- pgx/v5
- internal
- anynil
- sanitize
- stmtcache
- pgconn
- ctxwatch
- pgproto3
- pgtype
- pgxpool
- puddle/v2
- golang.org/x
- crypto
- pbkdf2
- sync
- semaphore
- text
- cases
- internal/language
- compact
- language
- secure
- bidirule
- precis
- unicode
- bidi
- norm
- width
- vendor
- golang.org/x
- mod
- modfile
- module
- semver
- sync/errgroup
- tools
- go
- analysis
- analysistest
- checker
- internal
- analysisflags
- checker
- passes
- buildssa
- ctrlflow
- inspect
- internal/ctrlflowinternal
- unitchecker
- ast
- astutil
- edge
- inspector
- cfg
- gcexportdata
- internal/packagesdriver
- packages
- ssa
- types
- objectpath
- typeutil
- internal
- aliases
- analysisinternal
- analysis/driverutil
- astutil/free
- cfginternal
- diff
- lcs
- event
- core
- keys
- label
- facts
- gcimporter
- gocommand
- goroot
- packagesinternal
- pkgbits
- robustio
- ssainternal
- stdlib
- testenv
- tokeninternal
- typeparams
- typesinternal
- versions
- txtar
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
360 files changed
+55692
-26383
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
| 17 | + | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | | - | |
37 | | - | |
| 38 | + | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
263 | 274 | | |
264 | 275 | | |
265 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments