1
0
mirror of https://github.com/go-kratos/kratos.git synced 2026-05-22 10:15:24 +02:00

fix: fix encode form well known message bug (#1568)

fix: fix encode form well known message bug
This commit is contained in:
海雨
2021-10-20 17:00:55 +08:00
committed by GitHub
parent 318cacd04d
commit ad7df8d4bc
+2 -2
View File
@@ -158,10 +158,10 @@ func encodeMessage(msgDescriptor protoreflect.MessageDescriptor, value protorefl
case "google.protobuf.DoubleValue", "google.protobuf.FloatValue", "google.protobuf.Int64Value", "google.protobuf.Int32Value", case "google.protobuf.DoubleValue", "google.protobuf.FloatValue", "google.protobuf.Int64Value", "google.protobuf.Int32Value",
"google.protobuf.UInt64Value", "google.protobuf.UInt32Value", "google.protobuf.BoolValue", "google.protobuf.StringValue": "google.protobuf.UInt64Value", "google.protobuf.UInt32Value", "google.protobuf.BoolValue", "google.protobuf.StringValue":
fd := msgDescriptor.Fields() fd := msgDescriptor.Fields()
v := value.Message().Get(fd.ByName(protoreflect.Name("value"))).Message() v := value.Message().Get(fd.ByName(protoreflect.Name("value")))
return fmt.Sprintf("%v", v.Interface()), nil return fmt.Sprintf("%v", v.Interface()), nil
case "google.protobuf.FieldMask": case "google.protobuf.FieldMask":
m, ok := value.Interface().(*field_mask.FieldMask) m, ok := value.Message().Interface().(*field_mask.FieldMask)
if !ok { if !ok {
return "", nil return "", nil
} }