Skip to content

Latest commit

 

History

History
20 lines (17 loc) · 929 Bytes

WIRE.md

File metadata and controls

20 lines (17 loc) · 929 Bytes

Wire dependency injection

The cacheroach project uses Wire, which provides compile-time dependency injection for Go. Wire takes care of handling both set-up and tear-down of singleton service objects within cacheroach.

Rules

  • Each package should expose a public ProviderSet named Set.
  • If provider functions are used to construct a stateful object, it should be in a ready-to-use state when it is returned from the provider. Stateful objects should return a cleanup function from the provider which will release any external resources.
  • Packages that need to test injected types should define an unexported, minimally-scoped "test rig" injector type.