Fix no-op logger setup in client test - #62
Merged
Conversation
lgr.Out returns an Option, so calling it on its own builds the option and discards it. The test intended to send log output to io.Discard for its duration and restore stdout afterwards, and did neither; staticcheck flags the deferred form as SA9010 under the pinned golangci-lint v2.12.2.
umputun
approved these changes
Aug 20, 2026
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.
lgr.Outreturns anOption; it does not change anything by itself.app/cmd/client_test.go:31-32calls it twice as a bare statement, so the test neither redirects log output toio.Discardfor its duration nor restores stdout afterwards, andTestClientprints through as before. Wrapping both calls inlgr.Setup, the form used everywhere else in the tree, makes the intent work.staticcheck also reports the deferred line, though only on some toolchains, which is presumably why it has never shown up in CI. With the golangci-lint version pinned in
.github/workflows/ci.yml:The change clears it in both environments, and the tests pass with
-raceagainst mongo 4.4 and mongo 8.