You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const (
// Anything is used in Diff and Assert when the argument being tested// shouldn't be taken into consideration. Anything="mock.Anything"
)
This has multiple problems:
the implementation details are public. This is a design mistake.
as the sentinel value is just an untyped string there is a non-zero risk of user code conflict
I propose to hide the implementation of Anything by making it a special value of a private type anything:
typeanythingstruct{}
// Anything is used in Diff and Assert when the argument being tested// shouldn't be taken into consideration. varAnythinganything
The text was updated successfully, but these errors were encountered:
This has bugged me every time I've seen it. I'm scared of this because is meets the definition of a breaking change, annoyingly.
Attention need to be paid to assertion failures where this string const is used, seeing it here annoys me too, and we can change this whenever we want, it's not breaking.
mock.Anything is currently implemented as:
This has multiple problems:
I propose to hide the implementation of
Anything
by making it a special value of a private typeanything
:The text was updated successfully, but these errors were encountered: