diff options
Diffstat (limited to 'object/parse.go')
| -rw-r--r-- | object/parse.go | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/object/parse.go b/object/parse.go index 81996206..2a6c629f 100644 --- a/object/parse.go +++ b/object/parse.go @@ -20,8 +20,6 @@ var ErrSizeMismatch = errors.New("object: size mismatch") // ParseWithHeader parses a loose object // in "type size\x00body" format. -// -//nolint:ireturn func ParseWithHeader(raw []byte, objectFormat id.ObjectFormat) (Object, error) { ty, size, headerLen, err := header.Parse(raw) if err != nil { @@ -29,7 +27,7 @@ func ParseWithHeader(raw []byte, objectFormat id.ObjectFormat) (Object, error) { } body := raw[headerLen:] - if uint64(len(body)) != size { + if len(body) != size { return nil, fmt.Errorf("%w: header declares %d bytes, body has %d", ErrSizeMismatch, size, len(body)) } @@ -37,19 +35,17 @@ func ParseWithHeader(raw []byte, objectFormat id.ObjectFormat) (Object, error) { } // ParseWithoutHeader parses a typed object body. -// -//nolint:ireturn func ParseWithoutHeader(ty typ.Type, body []byte, objectFormat id.ObjectFormat) (Object, error) { switch ty { - case typ.TypeBlob: + case typ.Blob: return blob.Parse(body) //nolint:wrapcheck - case typ.TypeTree: + case typ.Tree: return tree.Parse(body, objectFormat) //nolint:wrapcheck - case typ.TypeCommit: + case typ.Commit: return commit.Parse(body, objectFormat) //nolint:wrapcheck - case typ.TypeTag: + case typ.Tag: return tag.Parse(body, objectFormat) //nolint:wrapcheck - case typ.TypeUnknown: + case typ.Unknown: return nil, typ.ErrInvalidType default: return nil, typ.ErrInvalidType |
