Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. do

do

MITGov2.0.0

A type-safe dependency injection toolkit for Go 1.18+ using generics, designed to replace uber/dig.

Visit WebsiteGitHubGitHub
2.8k stars108 forks0 contributors

What is do?

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.

Target Audience

Go developers building modular, maintainable applications such as microservices, APIs, or CLI tools who need robust dependency management.

Value Proposition

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.

Overview

⚙️ A dependency injection toolkit based on Go 1.18+ Generics.

Use Cases

Best For

  • Building modular Go applications with clear service boundaries
  • Managing complex dependency graphs in microservices architectures
  • Implementing type-safe dependency injection without code generation
  • Debugging and visualizing service dependencies in web applications
  • Replacing reflection-based DI libraries like uber/dig with generics
  • Creating CLI tools or workers with managed service lifecycles

Not Ideal For

  • Projects using Go versions older than 1.18 due to its generics requirement
  • Teams already deeply invested in reflection-based DI like uber/dig or code-generation tools like Google Wire
  • Applications with trivial dependency graphs where a full DI framework adds unnecessary complexity
  • Projects relying on dynamic, runtime service registration without compile-time type checks

Pros & Cons

Pros

Type-Safe Compile-Time Checks

Leverages Go 1.18+ generics to ensure dependency errors are caught at compile time, eliminating runtime panics common in reflection-based DI libraries.

Zero External Dependencies

Relies solely on the Go standard library, keeping the library lightweight and minimizing project bloat, as stated in the README.

Comprehensive Lifecycle Management

Includes health checks, graceful shutdown, and lifecycle hooks for robust service management, which is detailed in the service lifecycle features.

Built-in Debugging Tools

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.

Cons

Go Version Lock-In

Requires Go 1.18 or later, making it incompatible with legacy projects stuck on older Go versions, a limitation noted in the badges.

Framework-Specific Debugging

Web UI and middleware are only available for Gin, Fiber, Echo, and Chi, limiting debugging integration for other web frameworks or non-web applications.

Potential Over-Engineering

The rich feature set, including scope trees and parallel shutdown, can introduce unnecessary complexity for simple applications with straightforward dependency needs.

Open Source Alternative To

do is an open-source alternative to the following products:

u
uber/dig

uber/dig is a dependency injection library for Go applications developed by Uber that provides compile-time safe dependency injection through reflection and code generation. It helps manage object creation and dependency resolution in Go projects.

Frequently Asked Questions

Quick Stats

Stars2,750
Forks108
Contributors0
Open Issues30
Last commit6 days ago
CreatedSince 2022

Tags

#graceful-shutdown#injection#software-architecture#dependency-injection#go-library#di#service-container#golang#microservices#type-safe#dependency-graph#generics#dependency#container#healthcheck#go

Built With

G
Go

Links & Resources

Website

Included in

Go169.1k
Auto-fetched 1 day ago

Related Projects

fxfx

A dependency injection based application framework for Go.

Stars7,553
Forks339
Last commit5 months ago
digdig

A reflection based dependency injection toolkit for Go.

Stars4,465
Forks225
Last commit1 year ago
GoLobby/ContainerGoLobby/Container

A lightweight yet powerful IoC dependency injection container for the Go programming language

Stars614
Forks36
Last commit9 months ago
didi

Simple and yet powerful Dependency Injection for Go

Stars378
Forks15
Last commit4 months ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub