⚙️ A dependency injection toolkit based on Go 1.18+ Generics.
2,809
stars
411
commits
Go
primary language
Sep 10, 2026
updated
⚙️ A dependency injection toolkit based on Go 1.18+ Generics.
This library implements the Dependency Injection design pattern. It may replace the fantastic uber/dig package. samber/do uses Go 1.18+ generics and therefore offers a type‑safe API.
See also:
Why this name?
I love the short name for such a utility library. This name is the sum of DI and Go and no Go package uses this name.
# v2 (latest)
go get github.com/samber/do/v2@latest
# v1
go get github.com/samber/do@v1.6.0
# AI Agent Skill
npx skills add https://github.com/samber/cc-skills-golang --skill golang-samber-do
This library is v2 and follows SemVer strictly.
No breaking changes will be made to exported APIs before v3.0.0.
This library has no dependencies except the Go std lib.
Don't hesitate ;)
# Install some dev dependencies
make tools
# Run tests
make test
# or
make watch-test
Give a ⭐️ if this project helped you!
Copyright © 2022 Samuel Berthe.
This project is MIT licensed.
Go
99.8%
⚙️ A dependency injection toolkit based on Go 1.18+ Generics.
2,809
stars
411
commits
Go
primary language
Sep 10, 2026
updated
⚙️ A dependency injection toolkit based on Go 1.18+ Generics.
This library implements the Dependency Injection design pattern. It may replace the fantastic uber/dig package. samber/do uses Go 1.18+ generics and therefore offers a type‑safe API.
See also:
Why this name?
I love the short name for such a utility library. This name is the sum of DI and Go and no Go package uses this name.
# v2 (latest)
go get github.com/samber/do/v2@latest
# v1
go get github.com/samber/do@v1.6.0
# AI Agent Skill
npx skills add https://github.com/samber/cc-skills-golang --skill golang-samber-do
This library is v2 and follows SemVer strictly.
No breaking changes will be made to exported APIs before v3.0.0.
This library has no dependencies except the Go std lib.
Don't hesitate ;)
# Install some dev dependencies
make tools
# Run tests
make test
# or
make watch-test
Give a ⭐️ if this project helped you!
Copyright © 2022 Samuel Berthe.
This project is MIT licensed.
Go
99.8%