From 00998c7dd9d789e353c9518d13864b75cd23c55d Mon Sep 17 00:00:00 2001 From: Isaac Schwabacher <59542438+ijschwabacher@users.noreply.github.com> Date: Mon, 11 May 2020 19:05:48 -0400 Subject: [PATCH] jsonpb: fix a confusing error message (#1125) The in argument is a []byte. Using the %v print flag prints this list of integers instead of as a string representation of the enum value. Use %q instead. --- jsonpb/decode.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonpb/decode.go b/jsonpb/decode.go index 857383025b..7c6c5a5244 100644 --- a/jsonpb/decode.go +++ b/jsonpb/decode.go @@ -474,7 +474,7 @@ func (u *Unmarshaler) unmarshalSingularValue(v protoreflect.Value, in []byte, fd if hasPrefixAndSuffix('"', in, '"') { vd := fd.Enum().Values().ByName(protoreflect.Name(trimQuote(in))) if vd == nil { - return v, fmt.Errorf("unknown value %v for enum %s", in, fd.Enum().FullName()) + return v, fmt.Errorf("unknown value %q for enum %s", in, fd.Enum().FullName()) } return protoreflect.ValueOfEnum(vd.Number()), nil }