A type-safe dependency injection toolkit for Go 1.18+ using generics, designed to replace uber/dig.
Do is a dependency injection toolkit built for Go 1.18 and later, utilizing generics to offer a type-safe API. It helps developers manage service dependencies, lifecycles, and scopes in Go applications, replacing libraries like uber/dig with a modern, generics-based approach.
Go developers building modular, maintainable applications such as microservices, APIs, or CLI tools who need robust dependency management.
Developers choose Do for its type safety via Go generics, eliminating runtime errors common in reflection-based DI libraries. It provides a comprehensive feature set including scope trees, lifecycle hooks, and debugging tools without external dependencies or code generation.
⚙️ A dependency injection toolkit based on Go 1.18+ Generics.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Leverages Go 1.18+ generics to ensure dependency errors are caught at compile time, eliminating runtime panics common in reflection-based DI libraries.
Relies solely on the Go standard library, keeping the library lightweight and minimizing project bloat, as stated in the README.
Includes health checks, graceful shutdown, and lifecycle hooks for robust service management, which is detailed in the service lifecycle features.
Offers explain APIs and web UI middleware for frameworks like Gin and Fiber, aiding in dependency visualization and troubleshooting, as highlighted in the debugging section.
Requires Go 1.18 or later, making it incompatible with legacy projects stuck on older Go versions, a limitation noted in the badges.
Web UI and middleware are only available for Gin, Fiber, Echo, and Chi, limiting debugging integration for other web frameworks or non-web applications.
The rich feature set, including scope trees and parallel shutdown, can introduce unnecessary complexity for simple applications with straightforward dependency needs.
do is an open-source alternative to the following products: