GitHub - mickamy/injector: command-line tool that generates type-safe dependency injection (DI) code for Go projects
github.com·10h·
Discuss: DEV, Hacker News
Preview
Report Post

injector

injector is a command-line tool that generates type-safe dependency injection (DI) code for Go projects.

Unlike traditional DI frameworks that rely on provider sets or complex wiring DSLs, injector uses Go’s type system and a minimal marker tag to describe dependency injection in a clear and explicit way.

The core idea is simple:

  • The Container declares what is injected.
  • Providers declare how values are constructed.

Install

Install injector using go install:

go install github.com/mickamy/injector@latest

Core Concepts

1. Container

A Container is a struct that declares the components your application exposes. Fields marked with the inject tag are managed by injector.

type Container struct {
Service ser...

Similar Posts

Loading similar posts...