Before
or After
call of time.Time
GO-C4011 298
299 newChainStartLastUpdated, err := p.ChainStateLastUpdated(id)
300 require.NoError(t, err)
301 if !newChainStartLastUpdated.After(oldChainStartLastUpdated) { 302 t.Errorf("Last updated did not increase: old %v new %v", oldChainStartLastUpdated, newChainStartLastUpdated)
303 }
304}
381 peerData := p.store.PeerDataGetOrCreate(pid)
382
383 // No need to add backoff period, if the previous one hasn't expired yet.
384 if !time.Now().After(peerData.NextValidTime) { 385 return
386 }
387
Some calls of Before
or After
for time.Time
can be simplified and it is recommended
as well because the code will look simple and idiomatic.
x := !t.Before(t0)
x := t.After(t0)