github.com/smartystreets/clock (go): Package clock is a near drop-in replacement for time.Now().UTC() and time.Sleep(). The structs defined here are intended to be used as pointer fields on struct types. When nil, these references forward to the corresponding functions in the standard time package. When not nil they perform behavior that facilitates unit testing when accessing the current time or sleeping is involved. The main advantage to this approach is that it is not necessary to provide a non-nil instance in 'contructor' functions or wireup for production code. It is also still trivial to set a non-nil reference in test code.
Keywords: go|mocking-utility|testing-tools|time