fix(whois): check conn.Close return in tcp43RawDial (CI red on main) - #141
Conversation
golangci-lint v2.12.2 flags the bare `defer conn.Close()` under errcheck, turning CI red on main since the "Consolidate WHOIS" commit (4f7fead). v2 dropped the legacy default exclusions that v1 shipped, including EXC0001 (`.*Close`), so this line lints clean locally on v1 and fails in CI. Discard the return explicitly, matching the idiom already used in pkg/cache/cache.go and pkg/plugins/cidrs/rpsl.go, and the `_ = conn.SetDeadline(...)` line in this same function. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughThe TCP WHOIS connection cleanup now uses a deferred function to call ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Claude Review
Critical issues
None.
Security
No security concerns flagged.
Test coverage
No test needed — the deferred call behaves identically before and after; only the discarded return is now explicit. Matches the existing _ = conn.SetDeadline(...) idiom in the same function (tcp43.go:145), and CI Lint (golangci-lint v2.12.2, which drops the legacy EXC0001 .*Close exclusion) is the real check.
No critical issues — LGTM pending human review.
Summary
CI has been failing on
mainsince the Consolidate WHOIS commit (4f7fead). TheLintjob fails with a single errcheck issue; every other job in the run is green.Failing run: https://github.com/praetorian-inc/pius/actions/runs/31187027446
One line, in
tcp43RawDial:Why this only shows up in CI
CI pins golangci-lint v2.12.2. v2 dropped the legacy default exclusions that v1 shipped, one of which (
EXC0001) excluded.*Close. Anyone still on a v1 linter locally will see this line pass, which is likely how it reachedmain. Re-running v1 withexclude-use-default=falsereproduces the CI error character-for-character, including the139:18position, and reports clean after the fix.conn.Close()on a read-only WHOIS socket has no error worth acting on, so the return is discarded explicitly rather than logged. This matches the idiom already in the repo (pkg/cache/cache.go:89,100,108,pkg/plugins/cidrs/rpsl.go:107) and the_ = conn.SetDeadline(deadline)line six lines below it in the same function.JIRA or Linear
None. This is an unblock for red
main, not tracked work. Happy to file one if the team wants a record.Verification
go build ./...cleango vet ./pkg/whois/...cleango test ./pkg/whois/...->ok github.com/praetorian-inc/pius/pkg/whoisNo test added: the deferred call runs identically before and after, only the discarded return is now explicit, so no test could distinguish the two. CI's own Lint job is the real check.
🤖 Generated with Claude Code