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>
diff --git a/encoding/protojson/encode.go b/encoding/protojson/encode.go
index ad29455..b8c4aa2 100644
--- a/encoding/protojson/encode.go
+++ b/encoding/protojson/encode.go
@@ -40,6 +40,17 @@
 type MarshalOptions struct {
 	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
 	// without returning an error. If AllowPartial is false (the default),
 	// Marshal will return error if there are any missing required fields.
@@ -68,17 +79,6 @@
 	//  ╚═══════╧════════════════════════════╝
 	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
 	// messages. If nil, this defaults to using protoregistry.GlobalTypes.
 	Resolver interface {
diff --git a/encoding/prototext/encode.go b/encoding/prototext/encode.go
index a2211e9..43bd50a 100644
--- a/encoding/prototext/encode.go
+++ b/encoding/prototext/encode.go
@@ -44,16 +44,6 @@
 type MarshalOptions struct {
 	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
 	// indented-form with every textual element on a new line.
 	// If Indent is an empty string, then an arbitrary indent is chosen.
@@ -65,6 +55,16 @@
 	// Indent can only be composed of space or tab characters.
 	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
 	// messages. If nil, this defaults to using protoregistry.GlobalTypes.
 	Resolver interface {