3 ms·
I agree. I first started doing this (instead of the often recommended global monkey patch) when I started programming in Go. In our main application we pass in
by calebio 3y ago
I agree. I first started doing this (instead of the often recommended global monkey patch) when I started programming in Go.
In our main application we pass in a function that returns `time.Now()`, and in tests we pass in a function that returns whatever time object we want.