Skip to content

ci: suppress staticcheck SA5011 false positives in test files#3715

Merged
esengine merged 1 commit into
main-v2from
fix/golangci-sa5011-tests
Jun 9, 2026
Merged

ci: suppress staticcheck SA5011 false positives in test files#3715
esengine merged 1 commit into
main-v2from
fix/golangci-sa5011-tests

Conversation

@esengine

@esengine esengine commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Why

The pinned golangci-lint binary CI runs reports SA5011 (possible nil pointer dereference) on correct if x == nil { t.Fatal(...) }-guarded derefs in test files — its staticcheck doesn't treat t.Fatal as terminating. A locally-built golangci-lint (same v2.12.2) reports 0 issues on the same code, and the finding is masked by the golangci-lint-action cache until a go.sum change cold-busts it — so it surfaces per package and has repeatedly failed lint on otherwise-correct PRs (patched ad hoc in #3706 and #3714, with more packages still to hit).

Fix

Add a test-only exclusion for SA5011 in .golangci.yml. SA5011 still runs on production code; only _test.go guarded-deref false positives are suppressed. This stops the whack-a-mole instead of guarding each new test site by hand.

Verification

  • golangci-lint config verify passes (v2.12.2, the CI version).
  • golangci-lint run clean locally.

The pinned golangci-lint binary's staticcheck reports SA5011 (possible nil
pointer dereference) on `if x == nil { t.Fatal(...) }`-guarded derefs in tests
— it doesn't model t.Fatal as terminating. The same code is clean under a
locally-built golangci-lint, and the finding is masked by the action cache
until a go.sum change cold-busts it, so it surfaces per-package and has failed
lint on otherwise-correct PRs (handled ad hoc in #3706, #3714).

Scope a test-only SA5011 exclusion so it stops blocking PRs while SA5011 keeps
guarding production code.
@esengine esengine requested a review from SivanCola as a code owner June 9, 2026 14:26
@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label Jun 9, 2026
@esengine esengine merged commit 51cfa8c into main-v2 Jun 9, 2026
13 of 14 checks passed
@esengine esengine deleted the fix/golangci-sa5011-tests branch June 9, 2026 14:30
@esengine esengine mentioned this pull request Jun 9, 2026
3 tasks
SuMuxi66 pushed a commit to SuMuxi66/DeepSeek-Reasonix that referenced this pull request Jun 10, 2026
…ne#3715)

The pinned golangci-lint binary's staticcheck reports SA5011 (possible nil
pointer dereference) on `if x == nil { t.Fatal(...) }`-guarded derefs in tests
— it doesn't model t.Fatal as terminating. The same code is clean under a
locally-built golangci-lint, and the finding is masked by the action cache
until a go.sum change cold-busts it, so it surfaces per-package and has failed
lint on otherwise-correct PRs (handled ad hoc in esengine#3706, esengine#3714).

Scope a test-only SA5011 exclusion so it stops blocking PRs while SA5011 keeps
guarding production code.

Co-authored-by: reasonix <reasonix@deepseek.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant