1
0
mirror of https://github.com/mgechev/revive.git synced 2024-11-28 08:49:11 +02:00
revive/testdata/time_equal.go
2024-11-11 19:31:18 +01:00

19 lines
482 B
Go

package pkg
import "time"
func t() bool {
t := time.Now()
u := t
if !t.After(u) {
return t == u // MATCH /use t.Equal(u) instead of "==" operator/
}
return t != u // MATCH /use !t.Equal(u) instead of "!=" operator/
}
// issue #846
func isNow(t time.Time) bool { return t == time.Now() } // MATCH /use t.Equal(time.Now()) instead of "==" operator/
func isNotNow(t time.Time) bool { return time.Now() != t } // MATCH /use !time.Now().Equal(t) instead of "!=" operator/