Back to directory

dig

A Go dependency-injection library that generates plain Go code at compile time, combining a minimal Fx-style API with Wire-style code generation so there is no runtime reflection or extra runtime dependency.

dig

dig is a compile-time, code-generation dependency-injection library for Go, positioned between Uber's Fx, which offers an elegant API but relies on runtime reflection and can panic on dependency errors, and Google's Wire, which is reflection-free but has a verbose, counter-intuitive API. dig combines a minimal API of Build, Provide, Supply, Invoke and Module with Wire-style generation, so the dependency graph is resolved and checked when code is generated rather than at runtime.

Generated code is plain Go with no third-party runtime dependency, and the generator enforces closure-capture safety so inline closures cannot accidentally capture local variables, while also supporting generics and multiple instances of the same type distinguished by parameter names. The project is unrelated to Uber's own runtime-reflection container of a similar name, and ships a set of AI-assistant prompts documenting its API, troubleshooting and migration from Wire or Fx.

More in Libraries

See all 292
  • OpenDecision

    deepanwadhwa.github.io

    An open-source Python package that answers typed questions about application state or documents using a local natural-language-inference model, returning structured choice, score, yes/no or evidence-relation values instead of free text.

  • TradeCanvas

    bonguynvan.github.io

    A zero-dependency canvas charting engine for building TradingView-style trading charts in JavaScript, with 66 technical indicators, 24 drawing tools, 17 chart types, and real-time streaming.

  • 3d retro graphics

    3d-retro.com

    A free, CC0-licensed library of copy-paste retro 3D and demoscene graphics effects, such as plasma, raytracing, and voxel terrain, runnable as WebGL 1 or plain 2D canvas.