From dba644ff4cc911a3bd4b989a90261ed9279ba76f Mon Sep 17 00:00:00 2001 From: Rob Shakir Date: Thu, 9 Mar 2023 17:18:22 -0800 Subject: [PATCH] Remove usage of the proto Syntax call. (#792) * Remove usage of the proto Syntax call. * Fix `gofmt`. --- protomap/proto.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/protomap/proto.go b/protomap/proto.go index 3f3b9bb31..49bdd01c9 100644 --- a/protomap/proto.go +++ b/protomap/proto.go @@ -141,9 +141,7 @@ func (m unpopRange) Range(f func(protoreflect.FieldDescriptor, protoreflect.Valu } v := m.Get(fd) - isProto2Scalar := fd.Syntax() == protoreflect.Proto2 && fd.Default().IsValid() - isSingularMessage := fd.Cardinality() != protoreflect.Repeated && fd.Kind() == protoreflect.MessageKind - if isProto2Scalar || isSingularMessage { + if fd.HasPresence() { v = protoreflect.Value{} // use invalid value to emit null } if !f(fd, v) {