golang-uber-dig

Implement dependency injection in Golang applications using uber-go/dig library.

Updated Jun 27, 2026
One-click install
npx skills add https://github.com/LuigiAPCPereira/evolutiondocs --skill golang-uber-dig-luigiapcpereira
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-uber-dig
Source: https://github.com/LuigiAPCPereira/evolutiondocs/tree/main/.agents/skills/golang-uber-dig
Command: npx skills add https://github.com/LuigiAPCPereira/evolutiondocs --skill golang-uber-dig-luigiapcpereira

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This skill unit helps you implement dependency injection in Golang using the uber-go/dig library, simplifying the wiring of your application graph.

Core Features & Use Cases

  • Dependency Injection: Utilizes uber-go/dig for managing complex object graphs in Go applications.
  • Constructors & Invoke: Allows lazy loading and memoization of constructors.
  • Parameter & Result Objects: Facilitates dependency injection with structured parameter and result objects.
  • Named Values & Groups: Enables disambiguation and grouping of dependencies.
  • Decorate: Modifies values without rewriting constructors.
  • Scopes: Supports isolation and reusability of dependency graphs.
  • Lifecycle Management: When using fx on top of dig.

Quick Start

Install dig and set it up in your project.

Frequently Asked Questions about golang-uber-dig

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement dependency injection in Golang using dig?

You implement dependency injection by registering constructors in a dig container, which resolves and memoizes the application object graph lazily upon invocation. This simplifies wiring complex dependencies in Golang.

What is the best way to manage complex object graphs in Go applications?

Managing complex object graphs in Go is best handled using a dependency injection container like dig, which utilizes structured parameter and result objects to automate lazy loading and dependency resolution.

How do you disambiguate dependencies of the same type in a Go DI container?

To disambiguate dependencies of the same type in a Go DI container, use dig's Named Values and Groups features, which enable precise identification and grouping during object graph construction.

Does uber-go/dig support modifying dependencies without rewriting constructors?

Yes, uber-go/dig supports modifying dependencies without rewriting constructors through its Decorate feature, allowing you to alter values directly within the dependency injection container.

When should I use scopes for dependency management in Golang?

Use scopes for dependency management in Golang when you need isolation and reusability of dependency graphs, allowing different application parts to maintain distinct or shared dependency instances.