Skip to content

Commit 9bc5415

Browse files
committed
file.go: return the correct error message from load() when the cache at the given filePath has unexpected number of bucket chunks
Previously the error message was returning misleading information, which didn't contain the actual number of bucket chunks for the cache stored in the file.
1 parent 1412165 commit 9bc5415

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

file.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func load(filePath string, maxBytes int) (*Cache, error) {
144144
maxBucketBytes := uint64((maxBytes + bucketsCount - 1) / bucketsCount)
145145
expectedBucketChunks := (maxBucketBytes + chunkSize - 1) / chunkSize
146146
if maxBucketChunks != expectedBucketChunks {
147-
return nil, fmt.Errorf("cache file %s contains maxBytes=%d; want %d", filePath, maxBytes, expectedBucketChunks*chunkSize*bucketsCount)
147+
return nil, fmt.Errorf("cache file %s contains unexpected number of bucket chunks; got %d; want %d", filePath, maxBucketChunks, expectedBucketChunks)
148148
}
149149
}
150150

0 commit comments

Comments
 (0)