wgdonenotdeferred: parenthesized Done() statement escapes non-deferred detection (paren_unwrap_gap)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 76/100
Direzione di ricerca
Leggi pkg/linters/wgdonenotdeferred/wgdonenotdeferred.go in corrispondenza di inspectBody e confronta la gestione delle chiamate con i pattern di astutil.MatchDiscardedErrorCall o resourcetracker.go. Aggiungi un caso con Done() tra parentesi a testdata/src/wgdonenotdeferred/wgdonenotdeferred.go, quindi esegui i test esistenti di wgdonenotdeferred. Il lavoro è completato quando la chiamata tra parentesi non differita produce la diagnosi prevista.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Issue Type: Correctness bug (false negative) - missing ParenExpr unwrap, established paren_unwrap_gap class
Location: pkg/linters/wgdonenotdeferred/wgdonenotdeferred.go:86 (inspectBody)
Problem: The statement-level flag check does a bare type assertion with no ParenExpr unwrap first:
if call, ok := exprStmt.X.(*ast.CallExpr); ok { if isWaitGroupDone(pass, call) { ... } }
Per the Go spec ExpressionStmt grammar, function and method calls used as standalone statements may be parenthesized (the spec own example shows (<-ch) as valid). So a non-deferred call written as (wg.Done()) has exprStmt.X resolve to *ast.ParenExpr rather than *ast.CallExpr, the type assertion fails silently, and the loop moves on without ever calling isWaitGroupDone - the deadlock-risk diagnostic never fires for this exact shape, even though it is a straightforward Done() call with the exact same missing-defer bug the linter exists to catch.
Impact: Severity: medium (false negative, not false positive - a real deadlock-risk pattern is silently missed). wgdonenotdeferred is CI-enforced on BOTH native and wasm targets (.github/workflows/cgo.yml:1668 and :1695), so this gap is live in the enforced linter set, not latent. testdata/src/wgdonenotdeferred/wgdonenotdeferred.go has zero coverage of a parenthesized Done() call in either the Bad or Good fixture sections - the gap would not be caught by the existing test suite.
This is the same established pattern class already fixed in several sibling linters (closeerrorunchecked, typeassertionnil, walkdirignoredeerror, astutil.MatchDiscardedErrorCall, resourcetracker.go), applied here for the first time to wgdonenotdeferred, which had previously only been audited for the unrelated adjacent_defer_assumption and scope_boundary_funclit classes (both confirmed clean in prior runs) but never for this one.
Recommendation: Call astutil.UnwrapParenExpr(exprStmt.X) before the *ast.CallExpr assertion at line 86, mirroring the fix already applied in astutil.MatchDiscardedErrorCall and resourcetracker.go inspectNode. Add a parenthesized-call case to testdata (e.g. a BadParenthesized function with (wg.Done()) as a bare statement, expecting the same diagnostic) to lock in the fix.
Validation: Existing wgdonenotdeferred_test.go test suite plus the new parenthesized-call testdata case should both pass after the fix; no interaction expected with the loop-boundary or FuncLit-boundary logic since the fix only affects the initial type assertion.
Estimated Effort: Small (single UnwrapParenExpr call plus one testdata case).
Dedup check: gh api search/issues for wgdonenotdeferred+paren and wgdonenotdeferred alone found no prior issue describing this specific gap (only an unrelated closed refactor-clustering issue and CI-enforcement/scope-boundary issues, all already resolved).
Generated by 🤖 Sergo - Serena Go Expert · claude · agent · ~181 AIC · ⌖ ~1 AIC · ⊞ 5.4K · ◷
- expires on Oct 29, 2026, 8:00 PM UTC-08:00
- Lingua principale
- Go
- Stelle
- 5.4k
- Fork
- 596
- Merge medio
- 3h 40m
- PR unite (30g)
- 830
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di github/gh-aw
-
automation models
Difficoltà 1/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
automated-analysis code-quality cookie testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
automated conformance safe-outputs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
automated conformance safe-outputs
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
cookie eslint
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di github/gh-aw
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
keyxmakerx/Chronicle#1721 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Gentleman-Programming/gentle-ai#5720 ·
I maintainer di solito rispondono entro 1 giorno
-
compress: block buffers get re-zeroed on every call, and the zeroing is immediately overwrittenAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ClickHouse/ch-go#1218 ·
I maintainer di solito rispondono entro 13 giorni
-
effort:s impact:low raised-by:reviewer risk:low
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
medici-finance/assay#4251 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
stripCodeFence unti testsAperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
Edwin-metcalf/MetCode#30 ·
I maintainer di solito rispondono entro 1 giorno