golang-samber-do

Enable type-safe dependency injection in Go projects with samber/do v2.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/nrmnqdds/gomaluum --skill golang-samber-do-nrmnqdds
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-samber-do
Source: https://github.com/nrmnqdds/gomaluum/tree/main/.agents/skills/golang-samber-do
Command: npx skills add https://github.com/nrmnqdds/gomaluum --skill golang-samber-do-nrmnqdds

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Type-safe dependency injection in Go projects using samber/do v2 is made simple, scalable, and testable, enabling clean architecture and predictable initialization.

Core Features & Use Cases

  • Provides/Registers services with providers, values, transients, and eager initialization for flexible lifecycles
  • Uses scopes to organize modules and lifecycle boundaries across large applications
  • Resolves dependencies at the composition root and composes providers across packages
  • Supports health checks, graceful shutdown, testing overrides, and struct injection for production-grade apps

Quick Start

Install the library, create a root container with do.New(), register services with do.Provide, and retrieve them with do.Invoke to bootstrap your application.

Frequently Asked Questions about golang-samber-do

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

FAQPage Schema
How do I set up dependency injection in a Go application?

Dependency injection in a modular Go application is set up by creating a root container with do.New(), registering services using do.Provide, and retrieving them with do.Invoke. This enables type-safe wiring and predictable initialization at the composition root.

What is the best way to manage service lifecycles in Go DI?

The best way to manage service lifecycles in Go DI is by using providers, lazy, eager, and transient initialization options. This allows flexible control over when services are instantiated and how long they persist within application scopes.

Can I use scopes to organize dependencies across large Go modules?

Yes, you can use scopes to organize dependencies across large Go modules. Scopes help establish clear lifecycle boundaries and modularize service wiring, making complex application architectures easier to maintain and test.

Does this dependency injection approach support graceful shutdown and health checks?

Yes, this dependency injection approach supports graceful shutdown and health checks for production-grade applications. These features ensure your services terminate safely and allow monitoring of dependency availability during runtime.

How does struct injection work for wiring dependencies in Go?

Struct injection works by automatically populating struct fields with resolved dependencies from the container. This simplifies wiring by directly injecting required services into struct instances without manual retrieval calls.