goroutineresourceleak (81st linter): paren_unwrap_gap across lock/cancel/channel detection, day one
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 72/100
Línea de trabajo
Empieza con pkg/linters/goroutineresourceleak/goroutineresourceleak.go, donde la línea 75 ya llama correctamente a astutil.UnwrapParenExpr. Envuelve de la misma forma las aserciones sin envolver de las líneas 209, 216, 228, 322, 346, 355 y 379. Añade a testdata/src/a/a.go variantes entre paréntesis de los casos de cancel, mutex y channel. Está terminado cuando esos casos de testdata pasan y las pruebas existentes también pasan.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
pkg/linters/goroutineresourceleak (registered today via PR #68502, the 81st analyzer, registry.go confirms the delta from 80 to 81) independently reimplements lock/unlock, context-cancel, and channel send/receive/close detection rather than reusing the shared resourcetracker framework. It reproduces the long-established paren_unwrap_gap class (already filed and fixed across astutil.go, nilctxpassed, errstringmatch, sprintfbool, tolowerequalfold, timenowsub, httpstatuscode, seenmapbool, closeerrorunchecked, typeassertionnil, walkdirignoredeerror, and resourcetracker.go in prior runs) at no fewer than six call sites in one new file, pkg/linters/goroutineresourceleak/goroutineresourceleak.go:
contextCancelAcquisition(line 322): barerhs.(*ast.CallExpr).isDeferredCancel(line 346): baredeferStmt.Call.Fun.(*ast.Ident).mutexLockAcquisition(line 355): bareexprStmt.X.(*ast.CallExpr).isDeferredUnlock(line 379): baredeferStmt.Call.Fun.(*ast.SelectorExpr).markChannelUsage(lines 209, 216, 228): bare*ast.Identassertions onSendStmt.Chan, theclose()call argument, and theUnaryExpr.Xreceive operand.
Notably, the same file already imports astutil and correctly calls astutil.UnwrapParenExpr at line 75 (astutil.UnwrapParenExpr(call.Fun).(*ast.FuncLit)) for the goroutine literal itself, so the gap is an inconsistency within the file rather than a missing dependency.
Impact
Parenthesized forms are valid Go and compile identically to unparenthesized ones, for example ctx, cancel := (context.WithCancel(ctx)), defer (cancel()), (mu.Lock()), defer (mu.Unlock()), (ch) <- v, <-(ch), close((ch)). For the acquisition/defer sites, a parenthesized acquisition or deferred cleanup call means the whole per-goroutine check never engages, so a goroutine with a genuine unguarded leak using one of these forms is never reported. For the channel usage sites, a genuinely-used channel referenced once through a parenthesized identifier is treated as never sent/received/closed, producing a false-positive leak report on otherwise-correct code.
Not yet wired into .github/workflows/cgo.yml LINTER_FLAGS, so currently latent rather than CI-breaking, matching the filing bar used for prior day-one findings on new linters such as typeassertionnil and closeerrorunchecked.
Recommendation
Wrap each of the six bare type assertions with astutil.UnwrapParenExpr(...) first, consistent with the correct usage already present at line 75 of the same file.
Validation
Add parenthesized-form variants to testdata/src/a/a.go for each of the three checks (cancel, mutex, channel) to lock in the fix and prevent regression.
Effort: Medium — six call-site fixes in one file plus matching testdata.
Generated by 🤖 Sergo - Serena Go Expert · claude · agent · 375.9 AIC · ⊞ 5.2K · ◷
- expires on Oct 20, 2026, 8:01 PM UTC-08:00
- Lenguaje dominante
- Go
- Estrellas
- 5.4k
- Forks
- 584
- Merge medio
- 3 h 56 min
- PR fusionados (30 d)
- 810
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de github/gh-aw
-
agentic-workflows cascade-suspected
Dificultad 4/5 3-5 días Aptitud para principiantes 22/100
Los mantenedores suelen responder en 1 día
-
agentic-workflows cascade-suspected
Dificultad 4/5 3-5 días Aptitud para principiantes 18/100
Los mantenedores suelen responder en 1 día
-
agentic-workflows cascade-suspected
Dificultad 4/5 3-5 días Aptitud para principiantes 18/100
Los mantenedores suelen responder en 1 día
-
agentic-workflows cascade-suspected
Dificultad 4/5 1-2 días Aptitud para principiantes 15/100
Los mantenedores suelen responder en 1 día
-
agentic-workflows cascade-suspected
Dificultad 4/5 3-5 días Aptitud para principiantes 15/100
Los mantenedores suelen responder en 1 día
Todos los issues de github/gh-aw
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
puppe1990/amarra-cais#355 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Gentleman-Programming/engram#1899 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
security
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
SocialGouv/iterion#2483 ·
Los mantenedores suelen responder en 1 día