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 }