From 6c30280ad66a997b8e35f507cb340dee69a225b7 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 23 Aug 2019 11:41:52 -0700 Subject: [PATCH] reflect/protoreflect: emit valid Go from GoString Rather than using the syntax for GoString, emit something similar to TypeName(%d), which is functionally equivalent to casting the integer to the specified type. Change-Id: Ibf4bd680d1672fcaba9022fb6bd03bbfe249b8b7 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/191580 Reviewed-by: Herbie Ong --- reflect/protoreflect/proto.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reflect/protoreflect/proto.go b/reflect/protoreflect/proto.go index ed7e74d5..7152a4aa 100644 --- a/reflect/protoreflect/proto.go +++ b/reflect/protoreflect/proto.go @@ -150,7 +150,7 @@ func (s Syntax) GoString() string { case Proto3: return "Proto3" default: - return fmt.Sprintf("", s) + return fmt.Sprintf("Syntax(%d)", s) } } @@ -200,7 +200,7 @@ func (c Cardinality) GoString() string { case Repeated: return "Repeated" default: - return fmt.Sprintf("", c) + return fmt.Sprintf("Cardinality(%d)", c) } } @@ -330,7 +330,7 @@ func (k Kind) GoString() string { case GroupKind: return "GroupKind" default: - return fmt.Sprintf("", k) + return fmt.Sprintf("Kind(%d)", k) } }