You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe I have encountered a bug in rendering the Scope Tree when a child scope provides a value that was declared in the root/parent scope. The behavior is that when the Scope Tree is rendered it shows the duplicated value twice.
You can see what I mean with this repro:
package main
import (
"context""fmt""github.com/samber/do/v2"
)
funcmain() {
rootCtx:=context.Background()
// Create the rootScope with a context and a string provided.rootScope:=do.New(
do.Eager(rootCtx),
do.Eager("Hello, World!"),
)
_= do.MustInvoke[context.Context](rootScope) // Add (rootScope).context.Context to the invoked list.rootDebug:=do.ExplainInjector(rootScope)
fmt.Println(rootDebug.String())
// Create a childScope with only a context.childScope:=rootScope.Scope("child1",
do.Eager(rootCtx),
)
_= do.MustInvoke[context.Context](childScope) // Add (childScope).context.Context to the invoked list.childDebug:=do.ExplainInjector(childScope)
fmt.Println(childDebug.String())
// Print provided and invoked services.for_, svc:=rangechildScope.ListProvidedServices() {
fmt.Printf("[Provided]: Scope: %s\t Scope ID: %s\tService: %s\n", svc.ScopeName, svc.ScopeID, svc.Service)
}
invokedServices:=childScope.ListInvokedServices()
for_, svc:=rangeinvokedServices {
fmt.Printf("[Invoked] Scope: %s\t Scope ID: %s\tService: %s\n", svc.ScopeName, svc.ScopeID, svc.Service)
}
}
Like with listing the provided and invoked services I would expect that printing the Scope Tree would have only shown context.Context as being provided once.
The text was updated successfully, but these errors were encountered:
I believe I have encountered a bug in rendering the Scope Tree when a child scope provides a value that was declared in the root/parent scope. The behavior is that when the Scope Tree is rendered it shows the duplicated value twice.
You can see what I mean with this repro:
Playground link
Result:
Expectation:
Like with listing the provided and invoked services I would expect that printing the Scope Tree would have only shown
context.Context
as being provided once.The text was updated successfully, but these errors were encountered: