You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
nolint parity gap: 4 non-enforced context-family linters have no internal/nolint suppression (execcommandwithoutcontext, ctxback
[Content truncated due to length] #41377
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
No inline suppression for genuine, intentional exceptions: e.g. a best-effort/cleanup exec.Command that must survive parent-context cancellation, or a deliberately detached context.Background() in a fire-and-forget goroutine. Today the only options are awkward refactors or a blanket disable.
Inconsistent contributor experience across one linter family.
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
Each of the 4 linters imports internal/nolint and consults it before every pass.Report
testdata adds a //nolint:<analyzer> line that is not reported
go test ./pkg/linters/{execcommandwithoutcontext,ctxbackground,contextcancelnotdeferred,timesleepnocontext}/... passes
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.
Activity
github-actions commentedon Jul 2, 2026
This issue was automatically closed because it expired on 2026-07-02T05:12:52.784Z.