Open
Description
testifylint
currently does not warn when require.Equal
(or assert.Equal
) is used to compare time.Time
values. This can lead to subtle bugs due to how time.Time
includes monotonic clock readings, making reflect.DeepEqual
(and thus require.Equal) unreliable for time comparisons.
It would be helpful if the linter flagged these cases and recommended using Time.Equal()
combined with require.True
or assert.True
instead.
Example:
require.Equal(t, timeA, timeB) // No warning, but this is unsafe for time.Time
require.True(t, timeA.Equal(timeB)) // Preferred
Metadata
Metadata
Assignees
Labels
No labels