chore(lint): make discarded Close and Fprint errors explicit - #13
Merged
Conversation
golangci-lint's errcheck flagged deferred `Close` calls and test-server
`Fprint` writes whose errors were dropped implicitly. Every site is a
deliberate discard, not a latent bug: a file opened for reading, a TCP
conn closed after its latency was measured, `sql.Rows` whose error also
surfaces through the scan, an HTTP body already read to completion, and
`httptest` handler writes.
So state the discard rather than handle it, matching the
`defer func() { _ = tx.Rollback() }()` form already used in store.go. No
behaviour changes.
Applied to every occurrence in each file, not only the reported ones:
golangci-lint caps repeats of one message at three by default, so the
run understated the real count (17, not the 13 first shown). Uncapped,
`golangci-lint run ./...` is now at 0 issues.
Refs: #10
prorochestvo
added a commit
that referenced
this pull request
Aug 13, 2026
plans/plan_review_20260718.txt was added to the tree by mistake in #13: that commit staged with `git add -A`, which swept up a working note that had deliberately sat untracked. It is neither a plan under the plans/{completed,history} convention nor English-language repository content. Remove it from version control. The file stays on disk, untracked, as it was before.
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.
Refs: #10
Clears every
errcheckfinding in the tree.golangci-lint run ./...goes from 17issues to 0;
make testandmake lintstay green; no behaviour changes.What these findings were
All of them dropped an error implicitly. None was a latent bug — each is a
deliberate discard:
infrastructure/env.goinfrastructure/check.goinfrastructure/store.go,store_test.gosql.Rows; a real failure also surfaces through the scangateway/router/nokia.go,gateway/telegram/telegram.gogateway/router/nokia_test.gohttptesthandler writesSo the fix states the discard instead of handling it, using the form the codebase
already uses in
store.go:No comments were added at these sites:
_ =already says "deliberately dropped",and the existing comments in
store.goearn their place only because"rollback after commit" is genuinely non-obvious, which
Closeis not.On the count
The first run reported 13 issues, the fixed tree then reported 4 more, and the true
total was 17.
golangci-lintcaps repeats of an identical message at three(
max-same-issues), so the initial number understated the work. Re-run uncapped tosee the real state:
Every occurrence in each touched file was converted, not only the reported ones, so
the files are internally consistent rather than half-converted.
Scope
This does not adopt
golangci-lint— no.golangci.yml, no CI job, noruleguard, and nothing added to
go.mod. It only makes the tree clean under thelinter's default set (
errcheck,govet,ineffassign,staticcheck,unused),of which the other four were already clean.
Worth noting for #10: the 229-finding sweep recorded there comes from the shared
stack-go:lintconfiguration, and step 2 of its adoption plan pulls ingithub.com/quasilyte/go-ruleguard/dsl. That conflicts with the stdlib-only rule inCLAUDE.md(modernc.org/sqliteis the sole permitted dependency), evenbuild-tagged, so adoption needs that decision made first.