back to home

samber / do

⚙️ A dependency injection toolkit based on Go 1.18+ Generics.

View on GitHub
2,684 stars
104 forks
35 issues
GoMakefile

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing samber/do in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/samber/do)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

do - Dependency Injection **⚙️ A dependency injection toolkit based on Go 1.18+ Generics.** This library implements the Dependency Injection design pattern. It may replace the fantastic package. uses Go 1.18+ generics and therefore offers a type‑safe API. **See also:** • samber/ro: Reactive Programming for Go: declarative and composable API for event-driven applications • samber/lo: A Lodash-style Go library based on Go 1.18+ Generics • samber/mo: Monads based on Go 1.18+ Generics (Option, Result, Either...) • samber/cc-skills-golang: AI Agent Skills for Golang ---- 💖 Sponsored by: DBOS - Durable workflow orchestration library for Go ---- **Why this name?** I love the **short name** for such a utility library. This name is the sum of and and no Go package uses this name. 💡 Features • **📒 Service registration** • Register by type • Register by name • Register multiple services from a package at once • **🪃 Service invocation** • Eager loading • Lazy loading • Transient loading • Tag-based invocation • Circular dependency detection • **🧙‍♂️ Service aliasing** • Implicit (provide struct, invoke interface) • Explicit (provide struct, bind interface, invoke interface) • **🔁 Service lifecycle** • Health check • Graceful unload (shutdown) • Dependency-aware parallel shutdown • Lifecycle hooks • **📦 Scope (a.k.a module) tree** • Visibility control • Dependency grouping • **📤 Container** • Dependency graph resolution and visualization • Default container • Container cloning • Service override • **🧪 Debugging & introspection** • Explain APIs: scope tree and service dependencies • Web UI & HTTP middleware (std, Gin, Fiber, Echo, Chi) • **🌈 Lightweight, no dependencies** • **🔅 No code generation** • **😷 Type‑safe API** 🚀 Install This library is v2 and follows SemVer strictly. No breaking changes will be made to exported APIs before v3.0.0. This library has no dependencies except the Go std lib. 🔥 Migration from v1 to v2 Documentation here 🤠 Documentation • GoDoc: https://godoc.org/github.com/samber/do/v2 • Documentation • Examples • Project templates 🎬 Project boilerplate • do-template-api • do-template-worker • do-template-cli 🤝 Contributing • Ping me on Twitter @samuelberthe (DMs, mentions, whatever :)) • Fork the project • Fix open issues or request new features Don't hesitate ;) 👤 Contributors 💫 Show your support Give a ⭐️ if this project helped you! 📝 License Copyright © 2022 Samuel Berthe. This project is MIT licensed.