(fd protoreflect.FieldDescriptor)
| 234 | } |
| 235 | |
| 236 | func goTypeForField(fd protoreflect.FieldDescriptor) reflect.Type { |
| 237 | switch k := fd.Kind(); k { |
| 238 | case protoreflect.EnumKind: |
| 239 | if et, _ := protoregistry.GlobalTypes.FindEnumByName(fd.Enum().FullName()); et != nil { |
| 240 | return enumGoType(et) |
| 241 | } |
| 242 | return reflect.TypeOf(protoreflect.EnumNumber(0)) |
| 243 | case protoreflect.MessageKind, protoreflect.GroupKind: |
| 244 | if mt, _ := protoregistry.GlobalTypes.FindMessageByName(fd.Message().FullName()); mt != nil { |
| 245 | return messageGoType(mt) |
| 246 | } |
| 247 | return reflect.TypeOf((*protoreflect.Message)(nil)).Elem() |
| 248 | default: |
| 249 | return reflect.TypeOf(fd.Default().Interface()) |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | func enumGoType(et protoreflect.EnumType) reflect.Type { |
| 254 | return reflect.TypeOf(et.New(0)) |
no test coverage detected