What problem does it solve?
This Skill helps Go developers replace manual constructor wiring with type-safe dependency injection using samber/do, improving modularity, testability, and lifecycle management.
Core Features & Use Cases
- Service lifecycle management: Register lazy (default), eager, transient, and value services to match initialization and reuse requirements.
- Provider-based composition: Define services via provider functions returning (T, error) so failures are handled at registration/invocation time.
- Scoped lifecycles: Create child scopes to prevent request-scoped state from leaking across requests and to organize visibility by module.
- Operational readiness: Integrate health checks and graceful shutdown through samber/do interfaces and container-driven lifecycle hooks.
- Maintainable organization: Use do.Package to group infrastructure, domain, and transport registrations cleanly at the composition root.
Quick Start
Use samber/do in your Go codebase to build a root injector and register your services with do.Provide (or do.ProvideValue / do.ProvideTransient as appropriate), then resolve application components from the composition root using do.MustInvoke or do.Invoke.