Repository navigation
fix(api): check ignored errors and enforce errcheck in internal/api - #117
Merged
Merged
Conversation
- writeJSON logs a failed response encode. The status line is already sent, so a marshal bug would otherwise leave a truncated 200 response with no trace. - Tests stop servers through stopServer, which reports a failed Stop, and close response bodies through closeBody, which discards the error. TestServerStopStopsRateLimiter now asserts that stopping an unstarted server returns ErrServerNotStarted. errcheck now covers internal/api. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Deletes the internal/api errcheck rule and fixes the two findings in #97's lifecycle_test.go. 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.
Fixes all 103 errcheck findings in
internal/api(1 in production code, 102 in tests) and enforces errcheck there.writeJSON: it now logs a failed encode. The status line is already sent at that point, so a marshal bug used to leave a truncated 200 response with no trace.stopServerhelper reports a failedStopwitht.Errorf. A server that won't shut down should fail the test.closeBodyhelper discards the close error, because it says nothing about the server.TestServerStopStopsRateLimiter: this test stops a server it never started. It now assertsStopreturnsErrServerNotStartedinstead of ignoring the result.server.go,writes.goandlifecycle_test.go. Thepath-exceptline is the same one chore: remove cmd/crctest, a dev tool whose values TestCRC32C checks #112, fix: check ignored errors in dir and fsck; enforce errcheck there #114 and fix: check ignored errors in sfb and fileops; enforce errcheck there #116 edit; I'll rebase whichever of my PRs lands later.🤖 Generated with Claude Code