protobuf-go/internal
Damien Neil 01c0e8d680 proto, internal/impl: make wire output more consistent with v1
The v1 wire marshaler sorts fields as follows:
  - All extensions, sorted by field number.
  - All non-oneof fields, sorted by field number.
  - All oneof fields, in indeterminate order.

We already make some steps toward supporting this ordering: The
fast path encoder places extensions in sorted order at the start
of the message.

This commit moves oneof fields to the end of the message, makes the
reflection-based encoder use this ordering when deterministic marshaling
is enabled, and adds a test to catch unintentional changes to the
ordering.

Users SHOULD NOT depend on stability of the marshal output. It is
subject to change over time. Without deterministic marshaling enabled,
it is subject to change over calls to Marshal.

Change-Id: I6cfd89090d790a3bb50785f32b94d2781d7d08db
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/206800
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2019-11-12 20:59:03 +00:00
..
cmd internal/impl: optimize reflect methods 2019-09-19 17:45:34 +00:00
conformance encoding/prototext: add MarshalOptions.EmitUnknown 2019-09-17 02:56:29 +00:00
descfmt internal: improve use of detrand in descfmt and errors 2019-09-09 18:30:00 +00:00
descopts
detrand internal: improve use of detrand in descfmt and errors 2019-09-09 18:30:00 +00:00
encoding proto, internal/impl: store unknown MessageSet items in non-mset format 2019-11-11 19:40:27 +00:00
errors internal: improve use of detrand in descfmt and errors 2019-09-09 18:30:00 +00:00
fieldnum
fieldsort proto, internal/impl: make wire output more consistent with v1 2019-11-12 20:59:03 +00:00
filedesc internal/filedesc: move message options to L1 initialization 2019-11-08 00:29:25 +00:00
filetype reflect/protoregistry: add (*Types).Register{Message,Enum,Extension} 2019-10-31 16:23:42 +00:00
flags
fuzz reflect/protoreflect: remove nullability from repeated extension fields 2019-11-05 18:31:30 +00:00
impl proto, internal/impl: make wire output more consistent with v1 2019-11-12 20:59:03 +00:00
mapsort internal/mapsort: use explicit kind for strings 2019-09-05 22:07:15 +00:00
pragma
protolegacy reflect/protoregistry: add (*Types).Register{Message,Enum,Extension} 2019-10-31 16:23:42 +00:00
set
strs
testprotos proto, internal/impl: make wire output more consistent with v1 2019-11-12 20:59:03 +00:00