Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
proto: extend Marshal documentation, include an example
The example has been written so that it can be run, meaning it only uses packages that are included in the protobuf module (durationpb specifically). I included an Output: comment in the example so that pkgsite displays the program output even without having to run it (but running it is of course possible). I added a brief tip to protoscope, which is often mentioned in the protobuf.dev docs for illustrative purposes, and I think it really makes much clearer to the reader how the protobuf wire format looks like and what information survives the encoding process (field numbers and their values, but not field names like in JSON). The struct literal contains only one field so that we don’t need to marshal this message deterministically for stable wire format, which is not the point of the example and would be distracting. The value was chosen such that the wire format hex representation contains at least one byte that is clearly identifiable as hexadecimal, to avoid confusion. Change-Id: I86103abfd7d5b3f654aca3bfbb452f8ef7e49828 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/574455 Reviewed-by: Damien Neil <[email protected]> Reviewed-by: Lasse Folger <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
- Loading branch information