protobuf-go/proto
Damien Neil 4686e239b6 proto: add IsInitialized
Move all checks for required fields into a proto.IsInitialized function.

Initial testing makes me confident that we can provide a fast-path
implementation of IsInitialized which will perform more than
acceptably.  (In the degenerate-but-common case where a message
transitively contains no required fields, this check can be nearly
zero cost.)

Unifying checks into a single function provides consistent behavior
between the wire, text, and json codecs.

Performing the check after decoding eliminates the wire decoder bug
where a split message is incorrectly seen as missing required fields.

Performing the check after decoding also provides consistent and
arguably more correct behavior when the target message was partially
prepopulated.

Change-Id: I9478b7bebb263af00c0d9f66a1f26e31ff553522
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/170787
Reviewed-by: Herbie Ong <herbie@google.com>
2019-04-05 22:21:46 +00:00
..
decode_gen.go proto: check for required fields in encoding/decoding 2019-04-04 17:56:20 +00:00
decode_test.go proto: add IsInitialized 2019-04-05 22:21:46 +00:00
decode.go proto: add IsInitialized 2019-04-05 22:21:46 +00:00
encode_gen.go proto: check for required fields in encoding/decoding 2019-04-04 17:56:20 +00:00
encode_test.go proto: check for required fields in encoding/decoding 2019-04-04 17:56:20 +00:00
encode.go proto: add IsInitialized 2019-04-05 22:21:46 +00:00
isinit_test.go proto: add IsInitialized 2019-04-05 22:21:46 +00:00
isinit.go proto: add IsInitialized 2019-04-05 22:21:46 +00:00
proto.go proto: add IsInitialized 2019-04-05 22:21:46 +00:00
size_gen.go proto: add generic Size 2019-03-27 17:25:13 +00:00
size.go proto, runtime/protoiface: add support for fast-path marshaling 2019-04-02 21:23:04 +00:00