A small, dependency-management library for Go that supports deferred initialization, ordered initialization (topological ordering) and two resolution modes:
- named dependencies — register dependencies by a user-provided name and refer to other dependencies by name.
- typed dependencies — register dependencies by Go type and automatically reduce them into structs using reflection and generics.
This library is intentionally small and zero-dependency — it focuses on simple dependency orchestration,
deferred initialization (via Init) and safe shutdown (Close).
- Register dependencies (as
Dependencywrappers), not raw objects — allows deferred initialization and deterministic init order based on declared references. - Named and typed dependency implementations (
NamedDependency,TypedDependency). - Topological sorting with cycle detection for safe
Init()ordering. ReduceDependencies/MustReduceDependencieshelpers to assemble typed structs from registered dependencies.- Small and test-covered.
go get github.com/GrayDragon82/dependency1