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
I’m documenting a few edge-case bugs that came up while I was tinkering with the package. I have a branch with fixes for most of the currently open issues as well as the ones below. I just want to have them written down some where just in case I don’t get the PR open, and my code falls into the void.
The weirds:
the code will panic if a type implements the wrong return value for Equal. Say func (Type) Equal(Type) int.
the code will erroneously report zero and negative zero as inequal, but these values == as true.
the code is treating value.IsValid() as a definitive dereferenced nil-pointer, but this is not guaranteed. (Fixing this requires checking for the nil-pointers before derefing with .Elem(). When fixed, this lets us be a little more specific between <invalid value> and <nil pointer>)
deep.Equal(nil, bType) is not strictly comparing a <nil pointer> to a bType, but rather an “untyped nil”, which compares as inequal to a typed nil-pointer. (The bane of everyone who wonders how their return nil function could possible not compare equal to nil in the caller)
Activity
daniel-nichter commentedon Jun 23, 2024
Keeping this issue open in case others encounter these edge case and/or someone wants to fix and PR against the latest version of this pkg.
Move equality edge-case tests into deep_test.go
fix: guard Equal results and compare signed zeros (#48)