fix: clean up 15 lint violations and the events test data race#2
Merged
fix: clean up 15 lint violations and the events test data race#2
Conversation
Brings pulse to a green lint and race-test state. The fixes are all pre-existing issues that surfaced the first time CI ran against main. errcheck: - internal/torznab/types.go — MarshalXML now propagates EncodeToken errors via early-return. writeElement's internal EncodeToken calls are explicitly unchecked with `_ =` since the outer MarshalXML will surface a broken encoder at its next checked call. - internal/api/v1/torznab.go — 6 handler-side Write/Encode/Copy calls now use `_ =` since there's nothing meaningful to do with a response-side error after WriteHeader has fired. - internal/core/indexer/tester.go — io.Copy drain in defer uses `_ =`. - internal/core/health/checker.go — same drain pattern. - pkg/sdk/client_test.go — sqlDB.Exec cleanup loop uses `_, _ =`. ineffassign: - internal/core/indexer/tester.go — dropped the dead trailing-slash branch above capsURL. The next line overwrote the value anyway, so nothing actually changes at runtime. unused: - internal/core/indexer/prowlarr.go — removed the inline `result` type that used to be populated by the per-file loop but has been unreferenced since fetchAllViaZip / fetchIndividual replaced it. - internal/api/v1/download_clients.go — removed toDLClientBody, a no-op stub with a comment explaining it's handled inline. data race: - internal/events/bus_test.go — TestBusPublishSetsTimestamp used a shared `var received Event` that the handler goroutine wrote to and the main goroutine read without synchronization (bus_test.go:43 vs bus.go:87). Replaced with a buffered channel + select, which is race-free and also drops the brittle 50ms sleep. Verified with `go test -race ./...` and `golangci-lint run ./...` — both clean. Co-Authored-By: Claude Opus 4.6 (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
First green-CI pass on pulse. Clears every pre-existing issue the freshly-added CI surfaced when it ran against main for the first time. No functional changes to production code.
errcheck (12 violations → 0)
ineffassign (1 → 0)
unused (2 → 0)
data race (1 → 0)
Verification
```
go test -race -timeout 120s ./... # all packages pass
golangci-lint run ./... # zero findings
```
Test plan
Follow-ups (not in scope)
None on pulse. Sibling PRs on pilot/prism/haul will clear each app's own pre-existing test failures.