Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup: fix generic comparisons on protobuf messages #3153

Merged
merged 1 commit into from Nov 6, 2019

Conversation

@dsnet
Copy link
Contributor

dsnet commented Nov 6, 2019

Generated protobuf messages contain internal data structures
that general purpose comparison functions (e.g., reflect.DeepEqual,
pretty.Compare, etc) do not properly compare. It is already the case
today that these functions may report a difference when two messages
are actually semantically equivalent.

Fix all usages by either calling proto.Equal directly if
the top-level types are themselves proto.Message, or by calling
cmp.Equal with the cmp.Comparer(proto.Equal) option specified.
This option teaches cmp to use proto.Equal anytime it encounters
proto.Message types.

Generated protobuf messages contain internal data structures
that general purpose comparison functions (e.g., reflect.DeepEqual,
pretty.Compare, etc) do not properly compare. It is already the case
today that these functions may report a difference when two messages
are actually semantically equivalent.

Fix all usages by either calling proto.Equal directly if
the top-level types are themselves proto.Message, or by calling
cmp.Equal with the cmp.Comparer(proto.Equal) option specified.
This option teaches cmp to use proto.Equal anytime it encounters
proto.Message types.
@communitybridge-easycla

This comment has been minimized.

Copy link

communitybridge-easycla bot commented Nov 6, 2019

CLA Check
The committers are authorized under a signed CLA.

Copy link
Contributor

menghanl left a comment

Thanks for the fix. LGTM

@menghanl menghanl changed the title Fix generic comparisons on protobuf messages cleanup: fix generic comparisons on protobuf messages Nov 6, 2019
@menghanl menghanl merged commit 2d2f656 into grpc:master Nov 6, 2019
3 checks passed
3 checks passed
EasyCLA EasyCLA check passed. You are authorized to contribute.
Details
Mergeable Mergeable Run has been Completed!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.