fix: discard Close errors explicitly so golangci-lint passes - #7
Merged
Merged
Conversation
The lint job has failed on every CI run since Feb 10, including on main.
golangci-lint's errcheck flagged 15 calls to rows.Close() and
conceptRows.Close() in internal/db/labels.go and internal/db/learnings.go
whose error return was silently dropped. CI only showed 6 of them because
golangci-lint collapses repeats of the same message by default.
The rest of internal/db already uses `defer func() { _ = rows.Close() }()`
to mark the error as deliberately ignored; these two files predate or
missed that convention. This applies the same pattern: deferred closes
get the wrapper, and inline closes on early-return paths become
`_ = conceptRows.Close()`.
Clearing errcheck surfaced one staticcheck SA5011 in
TestGetCurrentTaskID: a false positive, since t.Fatal stops the test
before the dereference. It is restructured as `else if` rather than
suppressed, which is correct without the analyzer needing to know
t.Fatal does not return.
No behavior change: Close errors were already ignored; this only makes
that explicit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
lintCI job has failed on every run since Feb 10, including onmain, so every open PR shows a red check regardless of what it changes. The Node 20 deprecation notices in the logs are warnings only — build, test, and format use the same actions and pass.The actual failures are golangci-lint's
errcheck: 15 calls torows.Close()/conceptRows.Close()ininternal/db/labels.goandinternal/db/learnings.gowhose error return was silently dropped. CI only listed 6 because golangci-lint collapses repeats of the same message by default (max-same-issues: 3); running with--max-same-issues 0shows all 15.What changed
The rest of
internal/db(deps.go,queries.go,items.go) already usesdefer func() { _ = rows.Close() }()to mark the error as deliberately ignored. These two files missed that convention; this applies it:labels.go,learnings.go— deferred closes get the wrapper; inline closes on early-return paths become_ = conceptRows.Close()learnings_test.go— clearing errcheck surfaced a staticcheckSA5011(possible nil dereference) inTestGetCurrentTaskID. It's a false positive, sincet.Fatalstops the test before the dereference, but it's restructured aselse ifrather than suppressed, so it's correct without the analyzer needing to knowt.Fataldoesn't return.No behavior change: the Close errors were already being ignored; this makes that explicit.
Validation:
golangci-lint run --max-same-issues 0 --max-issues-per-linter 0with v2.7.2 (the version CI pins) reports 0 issues; tests pass.Once this merges, #6 should go green after a re-run or rebase.
🤖 Generated with Claude Code