News for hackers. Stuff that matters.
Re:Mocking time and testing event loops in Go by llimllib on Monday May 25, 2020 @09:37AM (#23300926)
Mocking the time module is not very hard, and I recommend writing your own custom mock that fits exactly what you need unless one of the available libraries does something particularly fancy that you need
Re:Mocking time and testing event loops in Go by jeffbee on Monday May 25, 2020 @12:08PM (#23302384)
It's surprisingly tricky, I wouldn't jump to conclusions. It would depend a great deal on how much fidelity you require to Go's undocumented behavior. For example did you know that the Go runtime (as of today) will not initiate any AfterFunc calls until the goroutine that called AfterFunc yields? Is your application silently reliant on this undocumented synchronization?
Re:Mocking time and testing event loops in Go by llimllib on Monday May 25, 2020 @08:31PM (#23306298)
Most people probably won't need to figure that out, and if they did then that would count as the "something fancy" I mentioned.

I'm not jumping to conclusions, I have my own mock for time that I wrote in an afternoon which has survived several years on a big golang app