Once you've done that same "make a low-tech simple replacement" for all of sleep, context deadlines, tickers, AfterFuncs, etc all of which are quite commonly used... you've basically done everything these libraries do. At about the same level of complexity.
Comments
At the risk of appearing low-tech, a much more simple, Goroutine-safe solution for dealing with "now-dependent" code:
type NowFunc func() time.Time
func getGreeting(nowFunc NowFunc) string {
}And just pass in `time.Now` in for live code, and your own inline function for simulating a time in tests.
For just calls to time.Now, sure.
Once you've done that same "make a low-tech simple replacement" for all of sleep, context deadlines, tickers, AfterFuncs, etc all of which are quite commonly used... you've basically done everything these libraries do. At about the same level of complexity.