aboutsummaryrefslogtreecommitdiff
path: root/objectstore/packed/idx_parse.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-02-21 13:38:02 +0800
committerGravatar Runxi Yu2026-02-21 14:28:15 +0800
commit94482cb2c97aa215f83940643c5d4c0933727dcb (patch)
treebee22fa113542abd1b863ee251fdcf0f9bd409b5 /objectstore/packed/idx_parse.go
parentdiff: Add package-level doc comment (diff)
signatureNo signature
*: Modernize and lint; add CI v0.1.17
Diffstat (limited to 'objectstore/packed/idx_parse.go')
-rw-r--r--objectstore/packed/idx_parse.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/objectstore/packed/idx_parse.go b/objectstore/packed/idx_parse.go
index a6adc721..0af72594 100644
--- a/objectstore/packed/idx_parse.go
+++ b/objectstore/packed/idx_parse.go
@@ -62,10 +62,7 @@ func (index *idxFile) parse() error {
return fmt.Errorf("objectstore/packed: idx %q has malformed 64-bit offset table", index.idxName)
}
index.offset64Count = offset64Bytes / 8
- maxOffset64Count := index.numObjects - 1
- if maxOffset64Count < 0 {
- maxOffset64Count = 0
- }
+ maxOffset64Count := max(index.numObjects-1, 0)
if index.offset64Count > maxOffset64Count {
return fmt.Errorf("objectstore/packed: idx %q has oversized 64-bit offset table", index.idxName)
}