Is there an easy way to stub out time.Now() globally during test?
With implementing a custom interface you are already on the right way. I take it you use the following advise from the golang-nuts thread you’ve posted: type Clock interface { Now() time.Time After(d time.Duration) <-chan time.Time } and provide a concrete implementation type realClock struct{} func (realClock) Now() time.Time { return time.Now() } func (realClock) … Read more