Skip to content
New issue

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

Add TypeMismatch instead NotFound invoke error #80

Closed
d-enk opened this issue May 13, 2024 · 1 comment
Closed

Add TypeMismatch instead NotFound invoke error #80

d-enk opened this issue May 13, 2024 · 1 comment
Milestone

Comments

@d-enk
Copy link

d-enk commented May 13, 2024

package main

import (
	"fmt"

	"github.com/samber/do/v2" // v2.0.0-beta.6
)

func main() {
	i := do.New()

	do.ProvideNamedValue(i, "NAME", 1)
	fmt.Println(do.InvokeNamed[any](i, "NAME"))
	// DI: could not find service `NAME`, available services: `NAME`
}

do/invoke.go

Lines 84 to 87 in 6a1325b

service, ok := serviceAny.(Service[T])
if !ok {
return empty[T](), serviceNotFound(injector, ErrServiceNotFound, invokerChain)
}

samber added a commit that referenced this issue May 13, 2024
@samber
Copy link
Owner

samber commented May 13, 2024

Fixed in 1998a7a

@samber samber closed this as completed May 13, 2024
@samber samber modified the milestone: v2 May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants