Skip to content

Glossary: Software Design Patterns in Go

Service locator

A global registry that code reaches into to fetch its dependencies, such as `registry["repo"]`. It hides the dependencies again and forces tests to change the global, so injection is preferred.

Where the book teaches it

Related terms

Dependency injectionRegistryGlobal mutable state