update codec to allow reuse buffers

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2024-09-17 08:30:51 +03:00
parent d466a05b9d
commit bb635e0a1f

View File

@ -138,7 +138,7 @@ func (c *protoCodecV2) Marshal(d []byte, v interface{}, opts ...codec.Option) ([
marshalOptions = f
}
}
return marshalOptions.MarshalAppend(d, m)
return marshalOptions.MarshalAppend(d[:0], m)
default:
return nil, codec.ErrInvalidMessage
}