protobuf-go/reflect
Joe Tsai 1dab2cb0ad reflect/prototype: avoid unescaping string defaults
According to google.protobuf.FieldDescriptorProto.default_value documentation:
>>>
For strings, contains the default text contents (not escaped in any way).
For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
<<<

Thus, use the default value ad-verbatim if the kind is a string.
For the bytes kind, we use the text format hack to unescape the string,
since the text format uses the same unescape syntax as C due to its heritage.

Change-Id: I79e6d4d7e8f0d1ebedccecb9424a49384485589d
Reviewed-on: https://go-review.googlesource.com/138515
Reviewed-by: Damien Neil <dneil@google.com>
2018-09-28 20:50:27 +00:00
..
protoreflect go.mod: rename google.golang.org/proto as github.com/golang/protobuf/v2 2018-09-24 16:11:50 +00:00
protoregistry go.mod: rename google.golang.org/proto as github.com/golang/protobuf/v2 2018-09-24 16:11:50 +00:00
prototype reflect/prototype: avoid unescaping string defaults 2018-09-28 20:50:27 +00:00