testify
testify copied to clipboard
Impossible to just compare public elements of a struct.
Hi there. Firstly, thanks for the great library. I've only run into one gripe so far.
There doesn't seem to be a way to compare only the public fields of a struct. For some reason assert.Equal compares private fields too. Why do I need this? To compare protobuf messages. The public fields are the actual valuable info, and the private fields are implementation details like "sizeCache" which are unimportant but still frequently different.
Agreed. Python's equivalent of mock.Anything
(mock.ANY
) also works for equality comparisons. However, I'm not saying that just because it works that way in Python it should also be the same here. That aside, there's already an existing discussion here: https://github.com/stretchr/testify/issues/758
Working on this!