style: clear the last lint findings on #55's code
- goconst: extracted testVariantKeyTwo alongside testVariantKeyOne. - paralleltest: t.Parallel() on TestEvictSourceBlobExcludesConcurrentStoreOfIdenticalContent. The test asserts that a concurrent store stays blocked for 200ms while eviction holds the content lock; parallel load can only make it more blocked, never less, so the assertion does not become timing-fragile. Verified over repeated full -race runs. - gosec G115: a live, justified suppression on the int64 conversion in ComputeDefaultCacheMaxBytes. The preceding clamp was an explicit if-statement that gosec could follow; the modernize linter requires it to be min(), which gosec's range analysis cannot see through. The clamp is still there and still correct, so the conversion cannot overflow. Unlike the directives removed earlier in this branch, this one is live: nolintlint confirms it suppresses a finding that is actually raised.
This commit is contained in:
@@ -66,6 +66,10 @@ func ComputeDefaultCacheMaxBytes(
|
||||
computed := freeBytes / freeSpaceFractionDenominator * freeSpaceFractionNumerator
|
||||
computed = min(computed, math.MaxInt64)
|
||||
|
||||
// gosec cannot see that min() above bounds computed, so it reads
|
||||
// this conversion as potentially overflowing. It cannot: computed is
|
||||
// at most math.MaxInt64 on every path here.
|
||||
//nolint:gosec // G115: clamped to MaxInt64 by min above
|
||||
limit := int64(computed)
|
||||
limit = max(limit, DefaultCacheMaxBytesFloor)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user