godi Documentation
godi brings type-safe dependency injection to Go with zero magic. Start simple, scale seamlessly.
Quick Start
// 1. Register your services
services := godi.NewServiceCollection()
services.AddSingleton(NewLogger)
services.AddScoped(NewUserService)
// 2. Build the container
provider, _ := services.BuildServiceProvider()
defer provider.Close()
// 3. Use your services
userService, _ := godi.Resolve[*UserService](provider)
That’s it! No annotations, no reflection magic, just functions.
Why godi?
✅ Never update constructors everywhere - Change once, godi handles the rest
✅ Perfect for web apps - Request isolation with scopes
✅ Testing made easy - Swap implementations instantly
✅ Start simple - Use only what you need
✅ Type-safe - Compile-time checking with generics