# codegangsta/inject

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/codegangsta-inject).**

978 stars · 146 forks · Go · MIT

## Links

- GitHub: https://github.com/codegangsta/inject
- awesome-repositories: https://awesome-repositories.com/repository/codegangsta-inject.md

## Description

Inject is a dependency injection library for Go that manages object lifecycles and wires application components by automating the provision of dependencies. It functions as a reflection-based container that maps specific values to their corresponding types, enabling the automatic retrieval and injection of objects into application logic.

The library distinguishes itself through its ability to perform automatic function invocation, where it inspects function signatures at runtime to resolve and provide required arguments from a central registry. It also supports struct field injection, which populates object properties by scanning for specific metadata tags during initialization.

The framework facilitates modular design through hierarchical container management, allowing child containers to delegate dependency lookups to parent scopes when a requested type is missing locally. This system supports interface-based resolution, ensuring that concrete implementations are correctly matched to requested types based on runtime evaluation.

## Tags

### Software Engineering & Architecture

- [Dependency Injection Frameworks](https://awesome-repositories.com/f/software-engineering-architecture/dependency-injection-frameworks.md) — Manages object lifecycles and wires complex dependencies in Go applications to improve modularity.
- [Dependency Injection Containers](https://awesome-repositories.com/f/software-engineering-architecture/dependency-injection-containers.md) — Provides a dependency injection container that supports chaining and hierarchical resolution. ([source](https://github.com/codegangsta/inject/blob/master/README.md))
- [Struct Tags](https://awesome-repositories.com/f/software-engineering-architecture/metadata-attachments/struct-tags.md) — Populates struct fields by scanning for metadata tags during object initialization.
- [Dependency Injection Population](https://awesome-repositories.com/f/software-engineering-architecture/metadata-attachments/struct-tags/reflection-based-population/dependency-injection-population.md) — Automatically populates struct fields with dependencies based on metadata tags. ([source](https://github.com/codegangsta/inject#readme))
- [Type-Based Dependency Mappings](https://awesome-repositories.com/f/software-engineering-architecture/object-management-systems/dependency-injection-containers/container-type-resolvers/container-based-dependency-injection/type-based-dependency-mappings.md) — Associates values with types to enable automatic retrieval and injection during runtime. ([source](https://github.com/codegangsta/inject#readme))

### Programming Languages & Runtimes

- [Reflection-Based Invocations](https://awesome-repositories.com/f/programming-languages-runtimes/function-invocation-mappings/reflection-based-invocations.md) — Executes functions by automatically resolving required arguments from mapped dependencies using reflection. ([source](https://github.com/codegangsta/inject#readme))
- [Dependency Injection Libraries](https://awesome-repositories.com/f/programming-languages-runtimes/go-libraries/dependency-injection-libraries.md) — Provides a toolkit for managing object lifecycles and resolving dependencies using reflection and type-based mapping.
- [Dependency Argument Injection](https://awesome-repositories.com/f/programming-languages-runtimes/function-argument-passing/dependency-argument-injection.md) — Automatically resolves and injects function arguments by inspecting signatures at runtime.
- [Function Invocation Mappings](https://awesome-repositories.com/f/programming-languages-runtimes/function-invocation-mappings.md) — Automates function execution by mapping dependencies to required parameters.

### Part of an Awesome List

- [Reflection-Based Dependency Resolution](https://awesome-repositories.com/f/awesome-lists/devtools/runtime-reflection/reflection-based-dependency-resolution.md) — Matches concrete implementations to requested interface types using runtime reflection.

### DevOps & Infrastructure

- [Hierarchical Containers](https://awesome-repositories.com/f/devops-infrastructure/dependency-management/dependency-injection-systems/service-containers/hierarchical-containers.md) — Supports nested container structures where child scopes inherit dependencies from parent containers.
