4 ms·
I recently discovered the joy of abstracting away time. I write a lot of software in Go for work. This library, https://github.com/benbjohnson/clock https://git
by dcuthbertson 4y ago
I recently discovered the joy of abstracting away time. I write a lot of software in Go for work. This library, https://github.com/benbjohnson/clock https://github.com/benbjohnson/clock, provides a Clock interface that can be used for creating either clocks with the same interface as the standard "time" module, or to create a mock clock that increments to the next tick on any and all tickers defined in the app. It really makes unit tests go faster, though it can be tricky to get the code right.