Address pre-existing lint findings surfaced by golangci-lint v2#38
Merged
Conversation
Removes the path-scoped exclusions added in PR #37 and fixes the 57 underlying findings (CI was previously seeing 45 due to the default max-same-issues=3 cap): - goconst (34): Extract repeated test fixtures (success/happy/ok, test@example.com, password123, /feeds, /signup, error JSON payloads, etc.) to package-level constants. Adds a shared test_consts_test.go for the api_test package. - noctx (21): Switch sqlite repos in auth/feed/item to the *Context variants (QueryContext, ExecContext, QueryRowContext) using context.Background() at the boundary. Pass t.Context() in router_test via httptest.NewRequestWithContext. End-to-end context propagation through the Repository / Service interfaces is left for a follow-up; this commit silences the linter without touching public APIs. - gosec (2): Annotate the JWT-bearing login response (G117) and the test-only mock RSS server write (G705) with justified //nolint:gosec comments. make build, go test ./..., and golangci-lint run all clean. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
Follow-up to #37. Removes the path-scoped lint exclusions and fixes the 57 underlying findings that the v1→v2 golangci-lint upgrade surfaced (CI saw 45 due to
max-same-issues=3default; uncapped count is 57)."success","test@example.com","/feeds", error JSON payloads, etc.) to package-level constants. Adds a sharedtest_consts_test.gofor theapi_testpackage.*Contextvariants usingcontext.Background()at the boundary.router_testuseshttptest.NewRequestWithContext(t.Context(), …). Plumbing a realcontext.Contextthrough theRepository/Serviceinterfaces is left for a separate, focused refactor.//nolint:gosecon the JWT-bearing login response (G117) and the test-only mock RSS write (G705).The temporary path-scoped exclusions added in PR #37 (
goconston_test.go,noctxon sqlite,gosecon login/testserver) are removed.Test plan
go test -mod=vendor -race ./...— all packages passgolangci-lint run --max-same-issues=0 --max-issues-per-linter=0→0 issuesmake buildproduces a static binarytests.yaml+pr.ymllinter job + matrix tests)Out of scope
context.Contextpropagation throughRepository/Serviceinterfaces (would touch ~15 files including mocks). Tracked separately.🤖 Generated with Claude Code