protobuf-go/testing/protocmp
Joe Tsai 96a44732e0 proto: distinguish between invalid and empty messages in Equal
The v1 proto.Equal function treats (*Message)(nil) and new(Message)
as being different, while v2 proto.Equal treated them as equal since
a typed nil pointer is functionally an empty message since the
protobuf data model has no concept of presence as a first-class
property of messages.

Unfortunately, a significant amount of code depends on this distinction
that it would be difficult to migrate users from v1 to v2 unless we
preserved similar semantics in the v2 proto.Equal.

Also, double down on these semantics for protocmp.Transform.

Fixes #965

Change-Id: I21e78ba6251401a0ac0ccf495188093973cd7f3f
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/213238
Reviewed-by: Damien Neil <dneil@google.com>
2020-01-06 19:37:38 +00:00
..
format.go testing/protocmp: initial commit of cmp helper package 2019-10-30 23:03:12 +00:00
util_test.go testing/protocmp: add Ignore options and Any support 2019-11-14 09:49:19 +00:00
util.go testing/protocmp: add Ignore options and Any support 2019-11-14 09:49:19 +00:00
xform_test.go proto: distinguish between invalid and empty messages in Equal 2020-01-06 19:37:38 +00:00
xform.go proto: distinguish between invalid and empty messages in Equal 2020-01-06 19:37:38 +00:00