mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-01 03:14:16 +00:00
reflect/protoreflect: emit valid Go from GoString
Rather than using the <unknown:%d> 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 <herbie@google.com>
This commit is contained in:
parent
72980ee410
commit
6c30280ad6
@ -150,7 +150,7 @@ func (s Syntax) GoString() string {
|
||||
case Proto3:
|
||||
return "Proto3"
|
||||
default:
|
||||
return fmt.Sprintf("<unknown:%d>", s)
|
||||
return fmt.Sprintf("Syntax(%d)", s)
|
||||
}
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ func (c Cardinality) GoString() string {
|
||||
case Repeated:
|
||||
return "Repeated"
|
||||
default:
|
||||
return fmt.Sprintf("<unknown:%d>", c)
|
||||
return fmt.Sprintf("Cardinality(%d)", c)
|
||||
}
|
||||
}
|
||||
|
||||
@ -330,7 +330,7 @@ func (k Kind) GoString() string {
|
||||
case GroupKind:
|
||||
return "GroupKind"
|
||||
default:
|
||||
return fmt.Sprintf("<unknown:%d>", k)
|
||||
return fmt.Sprintf("Kind(%d)", k)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user