testify icon indicating copy to clipboard operation
testify copied to clipboard

Use (time.Time).Equal for time objects

Open gfelixc opened this issue 5 years ago • 1 comments

Summary

Use built-in Equal method when compare time.Time objects

Changes

When use Equal, try to cast given objects into time.Time and uses (time.Time).Equal in case of true

Motivation

See #1010

Related issues

Closes #1010

Breaking change

gfelixc avatar Oct 17 '20 14:10 gfelixc

Does the exact same thing with #979. #979 is reverted shortly after merge, because, as #984 mentions, this only fixes comparing between time. a struct containing time still cannot be compared. #985 tried to fix this by creating something like reflect.DeepEqual and call time.Time.Equal when needed, but used unsafe pointers.

leoleoasd avatar Dec 31 '20 08:12 leoleoasd

Earlier duplicate of #1464

brackendawson avatar Feb 19 '24 12:02 brackendawson