From 0715891c86d1e10d2be741fff49b82497aa31e31 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Tue, 17 Sep 2024 08:29:40 +0300 Subject: [PATCH] update codec to allow reuse buffers Signed-off-by: Vasiliy Tolstov --- jsonpb.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonpb.go b/jsonpb.go index d611275..0d51eb8 100644 --- a/jsonpb.go +++ b/jsonpb.go @@ -142,7 +142,7 @@ func (c *jsonpbCodecV2) 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 }