MCPcopy
hub / github.com/golang/protobuf / MessageDescriptorProto

Function MessageDescriptorProto

descriptor/descriptor.go:169–180  ·  view source on GitHub ↗

MessageDescriptorProto returns the file descriptor proto representing the message and the message descriptor proto for the message itself. The returned proto messages must not be mutated.

(m proto.GeneratedMessage)

Source from the content-addressed store, hash-verified

167// the message and the message descriptor proto for the message itself.
168// The returned proto messages must not be mutated.
169func MessageDescriptorProto(m proto.GeneratedMessage) (*descriptorpb.FileDescriptorProto, *descriptorpb.DescriptorProto) {
170 rawDesc, idxs := MessageRawDescriptor(m)
171 if rawDesc == nil || idxs == nil {
172 return nil, nil
173 }
174 fd := deriveFileDescriptor(rawDesc)
175 md := fd.MessageType[idxs[0]]
176 for _, i := range idxs[1:] {
177 md = md.NestedType[i]
178 }
179 return fd, md
180}

Callers 2

TestMessageDescriptorFunction · 0.85
ForMessageFunction · 0.85

Calls 2

MessageRawDescriptorFunction · 0.85
deriveFileDescriptorFunction · 0.85

Tested by 1

TestMessageDescriptorFunction · 0.68