const defaultIndent … // Format formats the message as a multiline string. // This function is only intended for human consumption and ignores errors. // Do not depend on the output being stable. Its output will change across // different builds of your program, even when using the same version of the // protobuf module. func Format(m proto.Message) string { … } // Marshal writes the given [proto.Message] in textproto format using default // options. Do not depend on the output being stable. Its output will change // across different builds of your program, even when using the same version of // the protobuf module. func Marshal(m proto.Message) ([]byte, error) { … } type MarshalOptions … // Format formats the message as a string. // This method is only intended for human consumption and ignores errors. // Do not depend on the output being stable. Its output will change across // different builds of your program, even when using the same version of the // protobuf module. func (o MarshalOptions) Format(m proto.Message) string { … } // Marshal writes the given [proto.Message] in textproto format using options in // MarshalOptions object. Do not depend on the output being stable. Its output // will change across different builds of your program, even when using the // same version of the protobuf module. func (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) { … } // MarshalAppend appends the textproto format encoding of m to b, // returning the result. func (o MarshalOptions) MarshalAppend(b []byte, m proto.Message) ([]byte, error) { … } // marshal is a centralized function that all marshal operations go through. // For profiling purposes, avoid changing the name of this function or // introducing other code paths for marshal that do not go through this. func (o MarshalOptions) marshal(b []byte, m proto.Message) ([]byte, error) { … } type encoder … // marshalMessage marshals the given protoreflect.Message. func (e encoder) marshalMessage(m protoreflect.Message, inclDelims bool) error { … } // marshalField marshals the given field with protoreflect.Value. func (e encoder) marshalField(name string, val protoreflect.Value, fd protoreflect.FieldDescriptor) error { … } // marshalSingular marshals the given non-repeated field value. This includes // all scalar types, enums, messages, and groups. func (e encoder) marshalSingular(val protoreflect.Value, fd protoreflect.FieldDescriptor) error { … } // marshalList marshals the given protoreflect.List as multiple name-value fields. func (e encoder) marshalList(name string, list protoreflect.List, fd protoreflect.FieldDescriptor) error { … } // marshalMap marshals the given protoreflect.Map as multiple name-value fields. func (e encoder) marshalMap(name string, mmap protoreflect.Map, fd protoreflect.FieldDescriptor) error { … } // marshalUnknown parses the given []byte and marshals fields out. // This function assumes proper encoding in the given []byte. func (e encoder) marshalUnknown(b []byte) { … } // marshalAny marshals the given google.protobuf.Any message in expanded form. // It returns true if it was able to marshal, else false. func (e encoder) marshalAny(any protoreflect.Message) bool { … }