golang-samber-do

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

Updated May 30, 2026
One-click install
npx skills add https://github.com/ozan-fn/mqtt-capture --skill golang-samber-do-ozan-fn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-samber-do
Source: https://github.com/ozan-fn/mqtt-capture/tree/main/.agents/skills/golang-samber-do
Command: npx skills add https://github.com/ozan-fn/mqtt-capture --skill golang-samber-do-ozan-fn

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 helps developers implement dependency injection in Golang using the samber/do library, simplifying code organization and management.

Core Features & Use Cases

  • Dependency Injection: Facilitates the creation of loosely-coupled, testable code.
  • Service Containers: Manages service lifecycles and dependencies.
  • Scopes: Organizes services by lifecycle and visibility.
  • Use Case: When setting up a Go application with complex dependencies, this Skill provides a structured approach to dependency management.

Quick Start

Install samber/do and register your services using the provided provider functions.

Frequently Asked Questions about golang-samber-do

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

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

To use samber/do for dependency injection in Golang, install the library and register your services using the provided provider functions. This creates a service container that manages dependencies and organizes services by scope.

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

Using a service container like samber/do is the best way to manage service lifecycles in Go. It allows you to organize services by scope and visibility, handling their initialization and dependencies automatically.

How does a service container work in Golang for dependency management?

A service container works by storing and managing service instances and their dependencies. samber/do provides this container, allowing you to register services via provider functions and resolve them as needed, organized by scopes.

Do I need a specific Go version to use samber/do for dependency injection?

Yes, you need Go 1.18 or higher to use samber/do for dependency injection. You also need to install the samber/do library dependency to start registering services and setting up your service container.

When should I use a dependency injection container in Golang?

Use a dependency injection container in Golang when your application has complex dependencies. samber/do helps by providing a service container that manages these dependencies, ensuring your code remains loosely-coupled and testable.