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 #1957

Open
wants to merge 1 commit into
base: master
from

Conversation

@dsnet
Copy link
Member

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.

Checklist

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.
@Martin2112

This comment has been minimized.

Copy link
Contributor

Martin2112 commented Nov 7, 2019

For #1738.

@Martin2112

This comment has been minimized.

Copy link
Contributor

Martin2112 commented Nov 7, 2019

Seems to be a problem with travis build:

# github.com/google/trillian/server/errors [github.com/google/trillian/server/errors.test]
server/errors/errors_test.go:51:52: undefined: diff
@Martin2112 Martin2112 self-assigned this Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.