util/proto: do not return error from primitive marshalers

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-03-12 15:20:19 +03:00 committed by LeL
parent 732dd51b1b
commit 84d981e88e
14 changed files with 202 additions and 932 deletions

View file

@ -24,22 +24,10 @@ func (d *Decimal) StableMarshal(buf []byte) ([]byte, error) {
buf = make([]byte, d.StableSize())
}
var (
offset, n int
err error
)
var offset int
n, err = protoutil.Int64Marshal(decimalValueField, buf[offset:], d.val)
if err != nil {
return nil, err
}
offset += n
_, err = protoutil.UInt32Marshal(decimalPrecisionField, buf[offset:], d.prec)
if err != nil {
return nil, err
}
offset += protoutil.Int64Marshal(decimalValueField, buf[offset:], d.val)
protoutil.UInt32Marshal(decimalPrecisionField, buf[offset:], d.prec)
return buf, nil
}