golang-samber-do

Implement samber/do dependency injection with service containers in Go.

23|1|Updated May 10, 2026
One-click install
npx skills add https://github.com/berksunduri/GOPost --skill golang-samber-do-berksunduri
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-samber-do
Source: https://github.com/berksunduri/GOPost/tree/main/.agents/skills/golang-samber-do
Command: npx skills add https://github.com/berksunduri/GOPost --skill golang-samber-do-berksunduri

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires github.com/samber/do/v2, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the complexity and boilerplate code involved in manual dependency injection in Go, promoting cleaner, more manageable codebases by leveraging samber/do.

Core Features & Use Cases

  • Dependency Injection: Simplify the process of injecting dependencies into Go applications, reducing manual constructor injection.
  • Service Containers: Leverage samber/do's service containers for lifecycle management, scoping, and module organization.
  • Use Case: For example, when integrating samber/do into a new or existing Go project, this Skill provides guidance on best practices for dependency registration and retrieval.

Quick Start

Activate the golang-samber-do skill with the command: do.New() to set up a new injector and start registering your services.

Frequently Asked Questions about golang-samber-do

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

FAQPage Schema
How do I simplify dependency injection in my Go application?

A service container in Go manages dependency lifecycle and scoping. Using samber/do, you register services within a container to organize modules and retrieve them dynamically, which removes the need to manually pass dependencies through constructors.

How do I set up a dependency injection container in Go using samber/do?

To set up a DI container, activate the skill and run the command `do.New()` to create a new injector. You then use this injector to register your Go services and manage their retrieval and lifecycle throughout the application.

Can I use this dependency injection approach for an existing Go project?

Yes, integrating a service container like samber/do is suitable for existing Go projects. It provides guidance on best practices for registering and retrieving dependencies, allowing you to incrementally adopt dependency injection without rewriting the entire codebase.

What is the best way to manage service lifecycle and scoping in Go?

The best way to manage service lifecycle and scoping is by leveraging a DI container. Samber/do provides built-in mechanisms for service registration and scoping, ensuring dependencies are instantiated and resolved correctly within their designated lifecycles.

Why does manual dependency injection create boilerplate in Go?

Manual dependency injection creates boilerplate because it requires explicitly passing every service through constructors. Using a framework like samber/do shifts this manual wiring to a central container, promoting cleaner and more manageable codebases.