A reflection-based dependency injection toolkit for Go applications.
Dig is a reflection-based dependency injection toolkit for Go that helps manage dependencies in applications. It automatically resolves and provides dependencies to components, reducing boilerplate code and simplifying object graph management. The toolkit is designed to work alongside application frameworks rather than replace them.
Go developers building medium to large applications that need structured dependency management, particularly those using or building application frameworks like Uber's Fx.
Developers choose Dig for its simplicity, type safety, and seamless integration with Go's existing patterns—it works with regular constructors and provides automatic dependency resolution without requiring extensive configuration or interface implementations.
A reflection based dependency injection toolkit for Go.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses Go's reflection to automatically discover and inject dependencies, eliminating manual boilerplate code for wiring complex object graphs.
Ensures dependencies are matched with correct types at compile time, reducing runtime errors and enhancing code reliability in large applications.
Works with regular Go constructors without requiring special interfaces or annotations, making it easy to integrate with existing codebases.
Identifies circular dependencies during the container build phase, providing clear error messages to help debug and refactor complex graphs early.
Relies on reflection for dependency resolution, which can introduce performance penalties during application startup compared to code-generation tools like Wire.
Designed only for resolving dependencies at initialization, making it unsuitable for scenarios requiring runtime dependency changes or lazy loading.
Lacks advanced features such as scoped dependencies or integrated configuration, often necessitating additional libraries for complete application needs.