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

how to use scope #90

Open
tulequ opened this issue Oct 8, 2024 · 0 comments
Open

how to use scope #90

tulequ opened this issue Oct 8, 2024 · 0 comments

Comments

@tulequ
Copy link

tulequ commented Oct 8, 2024

I'm new to samber/do

Currently I try v2 beta7, but have an issue

i := do.New()
s1 := i.Scope("feature1")
s2 := i.Scope("feature2")

do.Provide(i, NewClient)
do.Provide(s1, provideConfig1)
do.Provide(s2, provideConfig2)

do.MustInvoke[Client](s1)

This will cause issue could not find service ...Config

But with

do.Provide(i, NewClient)
do.Provide(i, provideConfig1)
do.Provide(s2, provideConfig2)

# or
do.Provide(s1, NewClient)
do.Provide(s1, provideConfig1)
do.Provide(s2, provideConfig2)

do.MustInvoke[Client](s1) will be ok

Do I use it wrong or missing something?

Thank for support

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

1 participant