mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-02-06 09:40:07 +00:00
encoding: re-arrange options
Move Multiline and Indent to the top so that there is a separation between options with semantic significance and those that are merely for aesthetic purposes. Change-Id: Icd5ee94ec010db8139a5e720f5b9842274fb3755 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/219500 Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
parent
5b335f7203
commit
91b2604634
@ -40,6 +40,17 @@ func Marshal(m proto.Message) ([]byte, error) {
|
|||||||
type MarshalOptions struct {
|
type MarshalOptions struct {
|
||||||
pragma.NoUnkeyedLiterals
|
pragma.NoUnkeyedLiterals
|
||||||
|
|
||||||
|
// Multiline specifies whether the marshaler should format the output in
|
||||||
|
// indented-form with every textual element on a new line.
|
||||||
|
// If Indent is an empty string, then an arbitrary indent is chosen.
|
||||||
|
Multiline bool
|
||||||
|
|
||||||
|
// Indent specifies the set of indentation characters to use in a multiline
|
||||||
|
// formatted output such that every entry is preceded by Indent and
|
||||||
|
// terminated by a newline. If non-empty, then Multiline is treated as true.
|
||||||
|
// Indent can only be composed of space or tab characters.
|
||||||
|
Indent string
|
||||||
|
|
||||||
// AllowPartial allows messages that have missing required fields to marshal
|
// AllowPartial allows messages that have missing required fields to marshal
|
||||||
// without returning an error. If AllowPartial is false (the default),
|
// without returning an error. If AllowPartial is false (the default),
|
||||||
// Marshal will return error if there are any missing required fields.
|
// Marshal will return error if there are any missing required fields.
|
||||||
@ -68,17 +79,6 @@ type MarshalOptions struct {
|
|||||||
// ╚═══════╧════════════════════════════╝
|
// ╚═══════╧════════════════════════════╝
|
||||||
EmitUnpopulated bool
|
EmitUnpopulated bool
|
||||||
|
|
||||||
// Multiline specifies whether the marshaler should format the output in
|
|
||||||
// indented-form with every textual element on a new line.
|
|
||||||
// If Indent is an empty string, then an arbitrary indent is chosen.
|
|
||||||
Multiline bool
|
|
||||||
|
|
||||||
// Indent specifies the set of indentation characters to use in a multiline
|
|
||||||
// formatted output such that every entry is preceded by Indent and
|
|
||||||
// terminated by a newline. If non-empty, then Multiline is treated as true.
|
|
||||||
// Indent can only be composed of space or tab characters.
|
|
||||||
Indent string
|
|
||||||
|
|
||||||
// Resolver is used for looking up types when expanding google.protobuf.Any
|
// Resolver is used for looking up types when expanding google.protobuf.Any
|
||||||
// messages. If nil, this defaults to using protoregistry.GlobalTypes.
|
// messages. If nil, this defaults to using protoregistry.GlobalTypes.
|
||||||
Resolver interface {
|
Resolver interface {
|
||||||
|
@ -44,16 +44,6 @@ func Marshal(m proto.Message) ([]byte, error) {
|
|||||||
type MarshalOptions struct {
|
type MarshalOptions struct {
|
||||||
pragma.NoUnkeyedLiterals
|
pragma.NoUnkeyedLiterals
|
||||||
|
|
||||||
// AllowPartial allows messages that have missing required fields to marshal
|
|
||||||
// without returning an error. If AllowPartial is false (the default),
|
|
||||||
// Marshal will return error if there are any missing required fields.
|
|
||||||
AllowPartial bool
|
|
||||||
|
|
||||||
// EmitUnknown specifies whether to emit unknown fields in the output.
|
|
||||||
// If specified, the unmarshaler may be unable to parse the output.
|
|
||||||
// The default is to exclude unknown fields.
|
|
||||||
EmitUnknown bool
|
|
||||||
|
|
||||||
// Multiline specifies whether the marshaler should format the output in
|
// Multiline specifies whether the marshaler should format the output in
|
||||||
// indented-form with every textual element on a new line.
|
// indented-form with every textual element on a new line.
|
||||||
// If Indent is an empty string, then an arbitrary indent is chosen.
|
// If Indent is an empty string, then an arbitrary indent is chosen.
|
||||||
@ -65,6 +55,16 @@ type MarshalOptions struct {
|
|||||||
// Indent can only be composed of space or tab characters.
|
// Indent can only be composed of space or tab characters.
|
||||||
Indent string
|
Indent string
|
||||||
|
|
||||||
|
// AllowPartial allows messages that have missing required fields to marshal
|
||||||
|
// without returning an error. If AllowPartial is false (the default),
|
||||||
|
// Marshal will return error if there are any missing required fields.
|
||||||
|
AllowPartial bool
|
||||||
|
|
||||||
|
// EmitUnknown specifies whether to emit unknown fields in the output.
|
||||||
|
// If specified, the unmarshaler may be unable to parse the output.
|
||||||
|
// The default is to exclude unknown fields.
|
||||||
|
EmitUnknown bool
|
||||||
|
|
||||||
// Resolver is used for looking up types when expanding google.protobuf.Any
|
// Resolver is used for looking up types when expanding google.protobuf.Any
|
||||||
// messages. If nil, this defaults to using protoregistry.GlobalTypes.
|
// messages. If nil, this defaults to using protoregistry.GlobalTypes.
|
||||||
Resolver interface {
|
Resolver interface {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user