We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When I try to declare a dependency in a struct using an interface, do fails to match that interface in InvokeStruct.
do
InvokeStruct
package main import ( "fmt" "github.com/samber/do/v2" ) type ISvc interface { Bar() } type Svc struct{} func (s *Svc) Bar() {} type Foo struct { Svc ISvc `do:""` } func main() { injector := do.New() do.ProvideValue(injector, Svc{}) s := do.MustInvokeStruct[Foo](injector) fmt.Printf("%+v\n", s) }
gives
panic: DI: could not find service `main.ISvc`, available services: `main.Svc`
It would be most useful if do could automatically match interfaces in InvokeStruct like it does for InvokeAs.
InvokeAs
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When I try to declare a dependency in a struct using an interface,
do
fails to match that interface inInvokeStruct
.gives
panic: DI: could not find service `main.ISvc`, available services: `main.Svc`
It would be most useful if
do
could automatically match interfaces inInvokeStruct
like it does forInvokeAs
.The text was updated successfully, but these errors were encountered: