From c7cfb3d3a303d89683e986dfcc93a087000f27bf Mon Sep 17 00:00:00 2001 From: Deathstroke <776022703@qq.com> Date: Sun, 12 May 2024 17:17:25 +0800 Subject: [PATCH] Fix the return value problem Signed-off-by: Deathstroke <776022703@qq.com> --- pkg/encoding/encoding.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/encoding/encoding.go b/pkg/encoding/encoding.go index 592709f..0507b89 100644 --- a/pkg/encoding/encoding.go +++ b/pkg/encoding/encoding.go @@ -98,11 +98,11 @@ func Convert(codecs serializer.CodecFactory, inMediaType, outMediaType string, i } else if inMediaType == JsonMediaType && outMediaType == YamlMediaType { val := map[string]interface{}{} if err := json.Unmarshal(in, &val); err != nil { - return nil, fmt.Errorf("error decoding from %s: %s", inMediaType, err) + return nil, nil, fmt.Errorf("error decoding from %s: %s", inMediaType, err) } encoded, err = yaml.Marshal(val) if err != nil { - return nil, fmt.Errorf("error encoding from %s: %s", outMediaType, err) + return nil, nil, fmt.Errorf("error encoding from %s: %s", outMediaType, err) } } else { inCodec, err := newCodec(codecs, typeMeta, inMediaType)