Closed sywhang closed 2 years ago
@hbdf reported this issue to me.
The ordering of Invoke seems to affect the value for private-provided types.
For example:
parent := dig.New() child := parent.Scope("child") child.Provide(func() string { return "child" }, dig.Export(false)) parent.Provide(func() string { return "parent" }) parent.Invoke(func(s string) { fmt.Println(s) }) child.Invoke(func(s string) { fmt.Println(s) })
prints:
parent parent
But the following code:
parent := dig.New() child := parent.Scope("child") child.Provide(func() string { return "child" }, dig.Export(false)) parent.Provide(func() string { return "parent" }) child.Invoke(func(s string) { fmt.Println(s) }) parent.Invoke(func(s string) { fmt.Println(s) })
child parent
The first code snippet should've really printed:
parent child
Fixed by #344.
@hbdf reported this issue to me.
The ordering of Invoke seems to affect the value for private-provided types.
For example:
prints:
But the following code:
prints:
The first code snippet should've really printed: