github.com/alecthomas/inject (go): Package inject provides dependency injection for Go. For small Go applications, manually constructing all required objects is more than sufficient. But for large, modular code bases, dependency injection can alleviate a lot of boilerplate.  The following example illustrates a simple modular application.  First, the main package installs configured modules and calls an entry point:  Next we have a simple Mongo module with a configurable URI:  The logging package shows idiomatic use of inject; it is just a thin wrapper around normal Go constructors. This is the least invasive way of using injection, and preferred.  Two interfaces to the injector are provided: SafeInjector and Injector. The former will return error values and the latter will panic on any error. The latter is commonly used because DI failures are typically not user-recoverable.  See the [README](https://github.com/alecthomas/inject/blob/master/README.md) for more details.
Keywords: dependency-injection|go|injection