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

Fix generic comparisons on protobuf messages #324

Merged
merged 1 commit into from Nov 7, 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.
@googlebot googlebot added the cla: yes label Nov 6, 2019
@coveralls

This comment has been minimized.

Copy link

coveralls commented Nov 6, 2019

Coverage Status

Coverage remained the same at 90.551% when pulling f47e597 on dsnet:master into 771dad5 on openconfig:master.

1 similar comment
@coveralls

This comment has been minimized.

Copy link

coveralls commented Nov 6, 2019

Coverage Status

Coverage remained the same at 90.551% when pulling f47e597 on dsnet:master into 771dad5 on openconfig:master.

@wenovus
wenovus approved these changes Nov 6, 2019
Copy link
Contributor

wenovus left a comment

Looks like you had to fix some by hand, thanks! LGTM

@wenovus wenovus merged commit 58b27d7 into openconfig:master Nov 7, 2019
3 checks passed
3 checks passed
cla/google All necessary CLAs are signed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 90.551%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.