Involved Source Files
Package protodesc provides functionality for converting
FileDescriptorProto messages to/from protoreflect.FileDescriptor values.
The google.protobuf.FileDescriptorProto is a protobuf message that describes
the type information for a .proto file in a form that is easily serializable.
The protoreflect.FileDescriptor is a more structured representation of
the FileDescriptorProto message where references and remote dependencies
can be directly followed.
desc_init.godesc_resolve.godesc_validate.goproto.go
Package-Level Type Names (total 6, in which 2 are exported)
/* sort exporteds by: | */
FileOptions configures the construction of file descriptors.
AllowUnresolvable configures New to permissively allow unresolvable
file, enum, or message dependencies. Unresolved dependencies are replaced
by placeholder equivalents.
The following dependencies may be left unresolved:
• Resolving an imported file.
• Resolving the type for a message field or extension field.
If the kind of the field is unknown, then a placeholder is used for both
the Enum and Message accessors on the protoreflect.FieldDescriptor.
• Resolving an enum value set as the default for an optional enum field.
If unresolvable, the protoreflect.FieldDescriptor.Default is set to the
first value in the associated enum (or zero if the also enum dependency
is also unresolvable). The protoreflect.FieldDescriptor.DefaultEnumValue
is populated with a placeholder.
• Resolving the extended message type for an extension field.
• Resolving the input or output message type for a service method.
If the unresolved dependency uses a relative name,
then the placeholder will contain an invalid FullName with a "*." prefix,
indicating that the starting prefix of the full name is unknown.
NoUnkeyedLiteralspragma.NoUnkeyedLiterals
New creates a new protoreflect.FileDescriptor from the provided
file descriptor message. The file must represent a valid proto file according
to protobuf semantics. The returned descriptor is a deep copy of the input.
Any imported files, enum types, or message types referenced in the file are
resolved using the provided registry. When looking up an import file path,
the path must be unique. The newly created file descriptor is not registered
back into the provided file registry.
NewFiles creates a new protoregistry.Files from the provided
FileDescriptorSet message. The descriptor set must include only
valid files according to protobuf semantics. The returned descriptors
are a deep copy of the input.
( T) addFileDeps(r *protoregistry.Files, fd *descriptorpb.FileDescriptorProto, files map[string]*descriptorpb.FileDescriptorProto) error
partialName is the partial name. A leading dot means that the name is full,
otherwise the name is relative to some current scope.
See google.protobuf.FieldDescriptorProto.type_name.
FullName converts the partial name to a full name on a best-effort basis.
If relative, it creates an invalid full name, using a "*." prefix
to indicate that the start of the full name is unknown.
( T) IsFull() bool( T) IsValid() bool
Package-Level Functions (total 19, in which 10 are exported)
NewFile creates a new protoreflect.FileDescriptor from the provided
file descriptor message. See FileOptions.New for more information.
NewFiles creates a new protoregistry.Files from the provided
FileDescriptorSet message. See FileOptions.NewFiles for more information.
ToDescriptorProto copies a protoreflect.MessageDescriptor into a
google.protobuf.DescriptorProto message.
ToEnumDescriptorProto copies a protoreflect.EnumDescriptor into a
google.protobuf.EnumDescriptorProto message.
ToEnumValueDescriptorProto copies a protoreflect.EnumValueDescriptor into a
google.protobuf.EnumValueDescriptorProto message.
ToFieldDescriptorProto copies a protoreflect.FieldDescriptor into a
google.protobuf.FieldDescriptorProto message.
ToFileDescriptorProto copies a protoreflect.FileDescriptor into a
google.protobuf.FileDescriptorProto message.
ToMethodDescriptorProto copies a protoreflect.MethodDescriptor into a
google.protobuf.MethodDescriptorProto message.
ToOneofDescriptorProto copies a protoreflect.OneofDescriptor into a
google.protobuf.OneofDescriptorProto message.
ToServiceDescriptorProto copies a protoreflect.ServiceDescriptor into a
google.protobuf.ServiceDescriptorProto message.
checkValidGroup reports whether fd is a valid group according to the same
rules that protoc imposes.
checkValidMap checks whether the field is a valid map according to the same
rules that protoc imposes.
See protoc v3.8.0: src/google/protobuf/descriptor.cc:6045-6115
The pages are generated with Goldsv0.3.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.