Releases: samber/do
Releases · samber/do
v2.0.0
🧭 Migration notes
Migration guide available: https://do.samber.dev/docs/upgrading/from-v1-x-to-v2
⚠️ Breaking changes
do.Injectorstruct turned into an interfaceinjector.ListProvidedServicesnow returns[]do.ServiceDescriptioninjector.ListInvokedServicesnow returns[]do.ServiceDescription- No more panic propagation on Provider error
- Service name in internal registry (eg:
*mypkg.MyService->*github.com/samber/example.MyService) - Hooks have been turned into now slices of hooks
injector.ShutdownOnSignalsandinjector.ShutdownOnSIGTERMnow returns(os.Signal, error)
🆕 Features
- New
Scope(formerlyInjector) with a tree structure:RootScope, child scopes, local or inherited services. - Support for transient services: ability to create services that are instantiated on every invocation through a dedicated mode.
- Support for service aliasing and invocation via interface binding
- Populate a struct and invoke services when
do:""tag is defined on attributes - Improved dependency graph troubleshooting: DAG representation, better tracing of service and scope chains. Added HTTP routes for easier troubleshooting.
- Circular dependency detection between services, with controlled panic instead of silent failure.
- Optional stack trace collection when invoking services for debugging purposes.
- Better error handling in Providers: panics are now converted into error.
- Support for
HealthcheckandShutdowninterfaces, with thread-safe shutdown and invocation handling. - More hooks
🛠️ Improvements
- Consistent error format.
- Extended test suite with improved coverage (> 90 % target).
- Refactorings: removed dead code, reduced
// @TODOs. - Implicit service names now include package path to avoid conflicts.
- Thread safe service loading and shutdown
- Parallel service health check and unload
- Health checks and shutdown methods now receive an optional context and support timeouts
🔍 Doc
- More lightweight
README.md: the documentation moved to https://do.samber.dev . - LLM-ready documentation
v2.0.0-rc1
Improvements
- the
do.ShutdownXXXmethods now return*do.ShutdownReport do.InvokeStruct[T]now returnsTinstead of*Tdo.InvokeStructnow supports implicit type aliasing- fixed cross-scope service alias
do.Service[T]is not exported anymore- better thread safety
- 93% test coverage
- more examples
- lots of doc improvements
- code quality improvements
...and lots of micro-fixes
See #45
v2.0.0-beta.7
v2.0.0-beta.6
- more tests
- fix typo in doc
- adding package abstraction (see doc)
- fix memory leak for invocation stacktraces
- shutdown services even if we detect a circular dependency
- upgrade go-type-to-string (improved interface naming)
- add support for multple hook handlers
- add hook at runtime
v2.0.0-beta.5
See #45
v2.0.0-beta.4
See #45
v2.0.0-beta.3
See #45
v2.0.0-beta.2
See #45
v2.0.0-beta.1
See #45
v1.6.0
Adds injector.ShutdownOnSignals(...) helper that receives a custom list of signals to listen.