mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-01 03:14:16 +00:00
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>
This commit is contained in:
parent
582ab3de42
commit
9e356dea53
@ -20,7 +20,7 @@ import (
|
||||
)
|
||||
|
||||
// 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)
|
||||
|
@ -22,7 +22,9 @@ import (
|
||||
"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 @@ type MarshalOptions struct {
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
|
Loading…
Reference in New Issue
Block a user