A full-featured dependency injection container for Go, offering intuitive auto-wiring and advanced features like lazy-loading and container scopes.
DI is a dependency injection container library for the Go programming language that facilitates organizing responsibilities in codebases and combining low-level implementations into high-level behavior without boilerplate. It implements inversion of control to increase modularity and extensibility in Go programs.
Go developers building modular, maintainable applications who want to manage dependencies cleanly without manual wiring, especially those familiar with or transitioning from libraries like google/wire or uber-go/dig.
Developers choose DI for its full-featured set of capabilities including intuitive auto-wiring, interface implementations, lazy-loading, and container scopes, all designed to reduce boilerplate and improve code organization in Go projects.
🛠 A full-featured dependency injection container for go programming language.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Automatically resolves and injects dependencies, significantly reducing manual boilerplate code as emphasized in the README's philosophy of reducing boilerplate.
Supports constructor, field, and optional injection, providing multiple strategies for dependency management as listed in the features section.
Includes tagging, grouping, and container scopes, enabling organized dependency graphs and scoped management for complex applications, highlighted in the key features.
Defers initialization until dependencies are needed, optimizing resource usage and application startup time, a feature explicitly mentioned in the documentation.
Relies on reflection for auto-wiring, which can introduce performance penalties in high-throughput scenarios compared to compile-time DI libraries like google/wire.
Requires careful initialization and error checking, as shown in the example where container creation and invocation must handle errors explicitly, adding boilerplate.
Lacks pre-built integrations with popular Go web frameworks, requiring developers to manually wire dependencies for tools like Gin or Fiber, unlike some ecosystem-specific DI solutions.