LabscoMCP early access ↗

The dig container builds an application's objects at startup by working out what each constructor needs — it is the engine underneath fx, used on its own when you do not want the rest of the framework.

WHEN TO USE

SCOPE

USE FOR

  • Wire a Go application's constructors into a dig container at startup.
  • Group four or more constructor dependencies into a dig.In parameter object.
  • Register two providers of the same concrete type as named dependencies.
  • Collect many providers, like HTTP handlers, into one slice with a value group.
  • Expose a concrete constructor under one or more interfaces with dig.As.
  • Validate the whole dependency graph in CI before it reaches production.

NOT FOR

  • Application lifecycle hooks, signal handling, or graceful shutdown — dig has none.