encoding/prototext: document unstable marshal output
Fixes golang/protobuf#920.
Change-Id: I04c12de9a662eb67994fc7eeceee1af4a9efee55
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/188937
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
diff --git a/encoding/protojson/encode.go b/encoding/protojson/encode.go
index 5f383fe..fde1829 100644
--- a/encoding/protojson/encode.go
+++ b/encoding/protojson/encode.go
@@ -20,7 +20,7 @@
)
// Marshal writes the given proto.Message in JSON format using default options.
-// Do not depend on the output of being stable. It may change over time across
+// Do not depend on the output being stable. It may change over time across
// different versions of the program.
func Marshal(m proto.Message) ([]byte, error) {
return MarshalOptions{}.Marshal(m)
diff --git a/encoding/prototext/encode.go b/encoding/prototext/encode.go
index b732f02..8856dae 100644
--- a/encoding/prototext/encode.go
+++ b/encoding/prototext/encode.go
@@ -22,7 +22,9 @@
"google.golang.org/protobuf/reflect/protoregistry"
)
-// Marshal writes the given proto.Message in textproto format using default options.
+// Marshal writes the given proto.Message in textproto format using default
+// options. Do not depend on the output being stable. It may change over time
+// across different versions of the program.
func Marshal(m proto.Message) ([]byte, error) {
return MarshalOptions{}.Marshal(m)
}
@@ -49,7 +51,9 @@
}
}
-// Marshal writes the given proto.Message in textproto format using options in MarshalOptions object.
+// Marshal writes the given proto.Message in textproto format using options in
+// MarshalOptions object. Do not depend on the output being stable. It may
+// change over time across different versions of the program.
func (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) {
if o.Resolver == nil {
o.Resolver = protoregistry.GlobalTypes