Skip to content

Address pre-existing lint findings surfaced by golangci-lint v2#38

Merged
cubny merged 1 commit into
masterfrom
lint-cleanup-pr37-followup
May 6, 2026
Merged

Address pre-existing lint findings surfaced by golangci-lint v2#38
cubny merged 1 commit into
masterfrom
lint-cleanup-pr37-followup

Conversation

@cubny

@cubny cubny commented May 6, 2026

Copy link
Copy Markdown
Owner

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=3 default; uncapped count is 57).

  • goconst×34 — Extract repeated test fixtures ("success", "test@example.com", "/feeds", 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 (auth, feed, item) to *Context variants using context.Background() at the boundary. router_test uses httptest.NewRequestWithContext(t.Context(), …). Plumbing a real context.Context through the Repository / Service interfaces is left for a separate, focused refactor.
  • gosec×2 — Justified //nolint:gosec on the JWT-bearing login response (G117) and the test-only mock RSS write (G705).

The temporary path-scoped exclusions added in PR #37 (goconst on _test.go, noctx on sqlite, gosec on login/testserver) are removed.

Test plan

  • go test -mod=vendor -race ./... — all packages pass
  • golangci-lint run --max-same-issues=0 --max-issues-per-linter=00 issues
  • make build produces a static binary
  • CI green (tests.yaml + pr.yml linter job + matrix tests)

Out of scope

  • End-to-end context.Context propagation through Repository / Service interfaces (would touch ~15 files including mocks). Tracked separately.

🤖 Generated with Claude Code

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>
@cubny cubny merged commit d5c7e96 into master May 6, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant