golang-samber-do

Configure type-safe dependency injection in Go applications using samber/do.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Manually wiring dependencies in Go projects is error‑prone and hard to maintain; this Skill provides a structured way to use samber/do for type‑safe dependency injection.

Core Features & Use Cases

  • Service Registration: Register lazy, eager, transient, and named services with clear provider functions.
  • Container Organization: Group registrations with do.Package and manage lifecycles using scopes.
  • Testing Support: Clone containers and override services for isolated unit tests.
  • Lifecycle Management: Implement health checks and graceful shutdown via standard interfaces. Use it when building Go applications that require clean architecture, modular service composition, and reliable startup/shutdown behavior.

Quick Start

Use this skill to install samber/do/v2, create a container, and register a basic service in your Go project.

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 Go using samber/do?

To set up dependency injection in Go with samber/do, you create a container and register services using provider functions. This Skill helps you install the samber/do/v2 module and configure type-safe service registration.

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

Managing service lifecycles in Go involves grouping registrations with do.Package and using scopes. This Skill provides structured lifecycle management, enabling health checks and graceful shutdown via standard interfaces.

Can I override dependencies for isolated unit tests in Go?

Yes, you can override dependencies for isolated unit tests in Go by cloning containers. This Skill supports cloning samber/do containers to replace specific services, ensuring test isolation without affecting the main container.

Does samber/do support both lazy and eager service loading?

Samber/do supports lazy, eager, transient, and named service registrations. This Skill allows you to configure these loading strategies with clear provider functions to match your application's startup and runtime requirements.

Why use a dependency injection container instead of manual wiring in Go?

Manual wiring in Go is error-prone and hard to maintain. Using a dependency injection container like samber/do provides type-safe service registration and modular composition, reducing boilerplate and preventing runtime wiring errors.

Do I need the Go binary to use samber/do for dependency injection?

Yes, you need the Go binary installed to use samber/do. This Skill requires the Go binary and the samber/do/v2 module to install, operate, and configure dependency injection in your project.