From 2a66eacdc933cb382ae8570f0d91a9eeef70a356 Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Mon, 22 Feb 2021 16:03:25 -0800 Subject: [PATCH] [not_panic_proto_codec] 1 --- encoding/proto/proto.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/encoding/proto/proto.go b/encoding/proto/proto.go index 0ecf4be0ecb0..3009b35afe7d 100644 --- a/encoding/proto/proto.go +++ b/encoding/proto/proto.go @@ -40,7 +40,7 @@ type codec struct{} func (codec) Marshal(v interface{}) ([]byte, error) { vv, ok := v.(proto.Message) if !ok { - return nil, fmt.Errorf("failed to marshal, message is %T, want proto", v) + return nil, fmt.Errorf("failed to marshal, message is %T, want proto.Message", v) } return proto.Marshal(vv) } @@ -48,7 +48,7 @@ func (codec) Marshal(v interface{}) ([]byte, error) { func (codec) Unmarshal(data []byte, v interface{}) error { vv, ok := v.(proto.Message) if !ok { - return fmt.Errorf("failed to marshal, message is %T, want proto", v) + return fmt.Errorf("failed to unmarshal, message is %T, want proto.Message", v) } return proto.Unmarshal(data, vv) }