From 5e9461f34dea2733908a30d8a5d1460b2289575d Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Mon, 23 Dec 2024 20:49:01 +0300 Subject: [PATCH] add codec.RawMessage support Signed-off-by: Vasiliy Tolstov --- jsonpb.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jsonpb.go b/jsonpb.go index a219e2c..9dd66a2 100644 --- a/jsonpb.go +++ b/jsonpb.go @@ -189,6 +189,12 @@ func (c *jsonpbCodecV2) Unmarshal(d []byte, v interface{}, opts ...codec.Option) } } return unmarshalOptions.Unmarshal(d, m) + case *codec.RawMessage: + *m = append((*m)[0:0], d...) + return nil + case codec.RawMessage: + copy(m, d) + return nil default: return codec.ErrInvalidMessage }