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.
(m proto.Message)
| 116 | // different builds of your program, even when using the same version of the |
| 117 | // protobuf module. |
| 118 | func (o MarshalOptions) Format(m proto.Message) string { |
| 119 | if m == nil || !m.ProtoReflect().IsValid() { |
| 120 | return "<nil>" // invalid syntax, but okay since this is for debugging |
| 121 | } |
| 122 | o.AllowPartial = true |
| 123 | b, _ := o.Marshal(m) |
| 124 | return string(b) |
| 125 | } |
| 126 | |
| 127 | // Marshal marshals the given [proto.Message] in the JSON format using options in |
| 128 | // Do not depend on the output being stable. Its output will change across |
no test coverage detected