golang-uber-dig

golang uber dig

samber ↓ 31k
Claude Code
View source ↗

What it does

  • pkg.go.dev/go.uber.org/dig
  • github.com/uber-go/dig
  • advanced.md — Decorate, Scopes, optional deps, error helpers, Visualize, full Quick Reference
  • recipes.md — end-to-end examples: HTTP server with route group, two databases, request scopes, decorators, dry-run validation
  • testing.md — testing patterns and graph validation
  • → See samber/cc-skills-golang@golang-uber-fx skill for application lifecycle, modules, and signal-aware Run() built on top of dig
  • → See samber/cc-skills-golang@golang-dependency-injection skill for DI concepts and library comparison

Requirements & configuration

  • Choose dig when you need the wiring graph only: CLI tools, libraries exposing a container to callers, test harnesses, or embedding DI into an existing app that manages its own lifecycle.
  • dig has no built-in lifecycle. If you need OnStart/OnStop hooks, signal handling, and graceful shutdown, use fx — see samber/cc-skills-golang@golang-uber-fx skill.
  • | Passing the container into services | The container belongs to main(). Inject the typed dependencies a service needs; otherwise tests need to build a real container. |

Derived from the skill's own SKILL.md documentation · extracted 2026-07-23

golang uber dig

Source

Repository: https://github.com/samber/cc-skills-golang

golang-uber-dig FAQ

What does the golang-uber-dig skill do?

Implements dependency injection in Golang using uber-go/dig — reflection-based container, Provide/Invoke, dig.In/dig.Out parameter and result objects, named values, value groups, optional dependencies, scopes, and Decorate. Apply when using or adopting uber-go/dig, when the codebase imports `go.uber.org/dig`, or when wiring an application graph at startup. For higher-level lifecycle and modules, see `samber/cc-skills-golang@golang-uber-fx` skill. pkg.go.dev/go.uber.org/dig github.com/uber-go/dig

What does golang-uber-dig require?

Choose dig when you need the wiring graph only: CLI tools, libraries exposing a container to callers, test harnesses, or embedding DI into an existing app that manages its own lifecycle. dig has no built-in lifecycle. If you need OnStart/OnStop hooks, signal handling, and graceful shutdown, use fx — see samber/cc-skills-golang@golang-uber-fx skill. | Passing the container into services | The container belongs to main(). Inject the typed dependencies a service needs; otherwise tests need to build a real container. |

How do I install golang-uber-dig?

Run: npx -y skills add https://github.com/samber/cc-skills-golang --skill golang-uber-dig --agent claude-code — the source lives at github.com/samber/cc-skills-golang.

Maintain golang-uber-dig?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

golang-uber-dig on getagentictools
[![golang-uber-dig on getagentictools](https://getagentictools.com/badge/skills/samber-cc-skills-golang-golang-uber-dig.svg)](https://getagentictools.com/skills/samber-cc-skills-golang-golang-uber-dig?ref=badge)
npx agentictools info skills/samber-cc-skills-golang-golang-uber-dig

The second line is the CLI lookup for this page — handy in READMEs and docs.