Summary
The earlier nolint-parity sweeps (#37061, #37251) added internal/nolint support to the CI-enforced custom linters but were explicitly scoped to that set. Four active context-propagation linters were left out — none of them wires internal/nolint, so a developer who hits a legitimate false positive has no inline escape hatch (//nolint:<name>) and must restructure code or disable the linter wholesale. Their sibling in the same family, httpnoctx, does wire nolint, which makes the gap an inconsistency rather than a deliberate choice.
Affected linters (no internal/nolint import; no BuildLineIndex/HasDirective call)
| Linter |
nolint wired? |
test-skip? |
Reports on prod code? |
httpnoctx (reference, CI-enforced) |
✅ yes |
✅ |
yes |
execcommandwithoutcontext |
❌ no |
✅ |
yes |
ctxbackground |
❌ no |
✅ |
yes |
contextcancelnotdeferred |
❌ no |
✅ |
yes |
timesleepnocontext |
❌ no |
✅ |
yes |
Location
pkg/linters/execcommandwithoutcontext/execcommandwithoutcontext.go — imports only internal/astutil + internal/filecheck; no nolint at all
pkg/linters/ctxbackground/ — no internal/nolint
pkg/linters/contextcancelnotdeferred/ — no internal/nolint
pkg/linters/timesleepnocontext/ — no internal/nolint
- Contrast:
pkg/linters/httpnoctx/httpnoctx.go:1 (header) wires internal/nolint
Impact
Recommendation
Mirror the established pattern already used by httpnoctx and ~20 other linters:
noLintLinesByFile := nolint.BuildLineIndex(pass, "<analyzer-name>") at the top of run
if nolint.HasDirective(pos, noLintLinesByFile) { return/continue } guarding each pass.Report
- Add a
//nolint:<name> case to each linter's testdata to lock the behavior in
Validation checklist
Effort
Small–moderate — mechanical, one well-trodden pattern repeated across 4 packages; follow httpnoctx verbatim. Distinct from #40734 (threshold linters largefunc/excessivefuncparams) and from #37061 (CI-enforced set), which together leave this non-enforced context-family set uncovered.
Found via Serena suppression-parity audit (R47).
Generated by 🤖 Sergo - Serena Go Expert · 260.8 AIC · ⌖ 11 AIC · ⊞ 5.9K · ◷
Summary
The earlier nolint-parity sweeps (#37061, #37251) added
internal/nolintsupport to the CI-enforced custom linters but were explicitly scoped to that set. Four active context-propagation linters were left out — none of them wiresinternal/nolint, so a developer who hits a legitimate false positive has no inline escape hatch (//nolint:<name>) and must restructure code or disable the linter wholesale. Their sibling in the same family,httpnoctx, does wire nolint, which makes the gap an inconsistency rather than a deliberate choice.Affected linters (no
internal/nolintimport; noBuildLineIndex/HasDirectivecall)httpnoctx(reference, CI-enforced)execcommandwithoutcontextctxbackgroundcontextcancelnotdeferredtimesleepnocontextLocation
pkg/linters/execcommandwithoutcontext/execcommandwithoutcontext.go— imports onlyinternal/astutil+internal/filecheck; no nolint at allpkg/linters/ctxbackground/— nointernal/nolintpkg/linters/contextcancelnotdeferred/— nointernal/nolintpkg/linters/timesleepnocontext/— nointernal/nolintpkg/linters/httpnoctx/httpnoctx.go:1(header) wiresinternal/nolintImpact
exec.Commandthat must survive parent-context cancellation, or a deliberately detachedcontext.Background()in a fire-and-forget goroutine. Today the only options are awkward refactors or a blanket disable.Recommendation
Mirror the established pattern already used by
httpnoctxand ~20 other linters:noLintLinesByFile := nolint.BuildLineIndex(pass, "<analyzer-name>")at the top ofrunif nolint.HasDirective(pos, noLintLinesByFile) { return/continue }guarding eachpass.Report//nolint:<name>case to each linter's testdata to lock the behavior inValidation checklist
internal/nolintand consults it before everypass.Report//nolint:<analyzer>line that is not reportedgo test ./pkg/linters/{execcommandwithoutcontext,ctxbackground,contextcancelnotdeferred,timesleepnocontext}/...passesEffort
Small–moderate — mechanical, one well-trodden pattern repeated across 4 packages; follow
httpnoctxverbatim. Distinct from #40734 (threshold linterslargefunc/excessivefuncparams) and from #37061 (CI-enforced set), which together leave this non-enforced context-family set uncovered.Found via Serena suppression-parity audit (R47).