aboutsummaryrefslogtreecommitdiff
path: root/object/parse.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-05-24 08:16:38 +0000
committerGravatar Runxi Yu2026-05-24 08:16:38 +0000
commitf84f3a3c79b09ad13fdc826933c4c1d8353cdefb (patch)
tree08bbd2a21b2125382fd7b1b5defbaffc2369b34c /object/parse.go
parentobject: Fix error handling (diff)
signatureNo signature
object{,/blob,/commit}: Fix lints
Diffstat (limited to 'object/parse.go')
-rw-r--r--object/parse.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/object/parse.go b/object/parse.go
index a4d0d350..6fbaa9b9 100644
--- a/object/parse.go
+++ b/object/parse.go
@@ -8,15 +8,13 @@ import (
"codeberg.org/lindenii/furgit/object/header"
"codeberg.org/lindenii/furgit/object/id"
"codeberg.org/lindenii/furgit/object/typ"
- // "codeberg.org/lindenii/furgit/object/tag"
- // "codeberg.org/lindenii/furgit/object/tree"
)
// SizeMismatchError indicates a mismatch
// between the size expected from the object header
// and the size of the object.
type SizeMismatchError struct {
- Expected int
+ Expected uint64
Got int
}
@@ -34,12 +32,12 @@ func (sizeMismatchError SizeMismatchError) Error() string {
func ParseWithHeader(raw []byte, algo id.Algorithm) (Object, error) {
ty, size, headerLen, err := header.Parse(raw)
if err != nil {
- return nil, err
+ return nil, err //nolint:wrapcheck
}
body := raw[headerLen:]
if uint64(len(body)) != size {
- return nil, SizeMismatchError{Expected: int(size), Got: len(body)}
+ return nil, SizeMismatchError{Expected: size, Got: len(body)}
}
return ParseWithoutHeader(ty, body, algo)