Use the Before, After, and Equal methods on time.Time values to compare them. These methods return boolean values indicating the chronological relationship between two times.
import "time"
t1 := time.Now()
t2 := t1.Add(time.Hour)
if t1.Before(t2) {
// t1 is earlier than t2
}
if t1.After(t2) {
// t1 is later than t2
}
if t1.Equal(t2) {
// t1 and t2 are the same instant
}