Skip to content

Glossary: Software Design Patterns in Go

Dependency injection

Also written: DI, injection, injecting

Giving code the dependencies it needs, usually as arguments, instead of letting it find or make them. This lets tests pass a fake notifier and a fixed clock, so they need no disk or email.

Where the book teaches it

Related terms

Constructor injectionDependency inversion principle (DIP)Composition rootService locator