Skip to content

Commit

Permalink
skip Errorf for a frequent error that is never read
Browse files Browse the repository at this point in the history
  • Loading branch information
sduchesneau committed Dec 2, 2024
1 parent 160fd93 commit 95d7819
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -1592,14 +1592,16 @@ func newObjectFromProto(o *storagepb.Object) *ObjectAttrs {
}
}

var ErrStorageDoesNotEncode32BitValue = errors.New("storage does not encode 32-bit value")

// Decode a uint32 encoded in Base64 in big-endian byte order.
func decodeUint32(b64 string) (uint32, error) {
d, err := base64.StdEncoding.DecodeString(b64)
if err != nil {
return 0, err
}
if len(d) != 4 {
return 0, fmt.Errorf("storage: %q does not encode a 32-bit value", d)
return 0, ErrStorageDoesNotEncode32BitValue
}
return uint32(d[0])<<24 + uint32(d[1])<<16 + uint32(d[2])<<8 + uint32(d[3]), nil
}
Expand Down

0 comments on commit 95d7819

Please sign in to comment.