Releases: sarulabs/di
Fix issues relative to types is Def.SetIs and Get
Fix issues #36 and #37 in Pull Request #38
- Get will now panic if called with a bad parameter instead of returning the first object in the container
- The behavior of SetIs changed to avoid calling reflect.TypeOf if the input is already a reflect.Type. It also panics if given a nil interface as its type can not be resolved.
New ParentContainer function
A new function ParentContainer was added because the old Parent does not return an error if the container does not have a parent.
I was implemented to solve the issue :
#35
Major speed improvements
It also adds new features (Def as Get parameter, types, ...) but mostly stays compatible with the previous version.
The biggest change is the Container type. It used to be an interface, but it is now a struct.
The documentation was reorganized.
Improve error messages in recovered panic
Also use %+v to print errors in when panic are recovered.
Improve error messages
Use %+v to print errors (instead of %s) to include things like stack traces if the type of the error supports it.
Add Builder.Set method
v2.4.0 Add the Set method to the builder (#19)
Unshared objects
Add unshared objects.
Service override
It is now possible to override a service in the Builder.
Fix closing order
This release fixes two bugs :
- The objects were closed in a random order. It was possible to have an object with a closed dependency. The objects are now closed in the right order. The dependencies are closed after the objects using them.
- The second bug was created in the last release. The Close function could be called on an object that was being built. In this case it was not possible to cast the object given to the Close function.
Fix concurrent build calls
Two requests could build the same object in the app scope.
The first one was used by the first request, while the second one was used by all the other requests. The first one was forgotten and never closed. It could happen if the first two Get calls were done at the same time or/and if the Build function took some time to be executed.