Problem
A full golangci-lint run currently reports five pre-existing warnings in test code. These were surfaced while reviewing #97 but are unrelated to that PR and should be fixed separately.
Unchecked file-close errors (errcheck)
checksum_test.go:83: defer f.Close() in testChecksumPages
checksum_test.go:116: defer f.Close() in legacyChecksumPages
Handle the close results explicitly using the repository test/helper conventions. Preserve any earlier operation error when propagating a close error from legacyChecksumPages.
Deprecated random reads (staticcheck SA1019)
ltx_test.go:698: rand.Read(data) in benchmarkChecksumPage
ltx_test.go:718: rand.Read(data) in benchmarkChecksumPageWithHasher
ltx_test.go:737: rand.Read(page) in BenchmarkXOR
math/rand.Read is deprecated. Replace it with an appropriate deterministic math/rand/v2 source for benchmark fixture data, or use crypto/rand if nondeterministic data is intentionally required. Keep random-data setup outside the timed benchmark sections.
Acceptance criteria
golangci-lint run exits successfully with no findings.
go test ./... passes.
go test -race ./... passes.
- Existing benchmarks continue to operate on populated page data without adding random-data generation to their timed sections.
- No production behavior changes are included.
Problem
A full
golangci-lint runcurrently reports five pre-existing warnings in test code. These were surfaced while reviewing #97 but are unrelated to that PR and should be fixed separately.Unchecked file-close errors (
errcheck)checksum_test.go:83:defer f.Close()intestChecksumPageschecksum_test.go:116:defer f.Close()inlegacyChecksumPagesHandle the close results explicitly using the repository test/helper conventions. Preserve any earlier operation error when propagating a close error from
legacyChecksumPages.Deprecated random reads (
staticcheckSA1019)ltx_test.go:698:rand.Read(data)inbenchmarkChecksumPageltx_test.go:718:rand.Read(data)inbenchmarkChecksumPageWithHasherltx_test.go:737:rand.Read(page)inBenchmarkXORmath/rand.Readis deprecated. Replace it with an appropriate deterministicmath/rand/v2source for benchmark fixture data, or usecrypto/randif nondeterministic data is intentionally required. Keep random-data setup outside the timed benchmark sections.Acceptance criteria
golangci-lint runexits successfully with no findings.go test ./...passes.go test -race ./...passes.