Skip to content

Glossary: Software Design Patterns in Go

Injected clock

Also written: clock, fixed clock

A function passed in that returns the time (`func() time.Time`), so a test can pass one that always says 4:00 p.m. You pass `time.Now` without brackets, not `time.Now()`.

Where the book teaches it

Related terms

Dependency injectionStub