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

Fix incorrect documentation on soft value group #932

Merged
merged 1 commit into from Aug 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions inout.go
Expand Up @@ -182,7 +182,7 @@ import "go.uber.org/dig"
// type Params struct {
// fx.In
//
// Handlers []Handler `group:"server"`
// Handlers []Handler `group:"server,soft"`
// Logger *zap.Logger
// }
//
Expand All @@ -191,13 +191,14 @@ import "go.uber.org/dig"
// Foo := func(Params) { ... }
//
// app := fx.New(
// fx.Provide(NewHandlerAndLogger),
// fx.Provide(NewHandler),
// fx.Provide(fx.Annotate(NewHandlerAndLogger, fx.ResultTags(`group:"server"`))),
// fx.Provide(fx.Annotate(NewHandler, fx.ResultTags(`group::"server"`))),
// fx.Invoke(Foo),
// )
//
// The only constructor called is `NewHandler`, because this also provides
// `*zap.Logger` needed in the `Params` struct received by `Foo`.
// The only constructor called is `NewHandlerAndLogger`, because this also provides
// `*zap.Logger` needed in the `Params` struct received by `Foo`. The Handlers
// group will be populated with a single Handler returned by `NewHandlerAndLogger`.
//
// In the next example, the slice `s` isn't populated as the provider would be
// called only because `strings` soft group value is its only consumer.
Expand Down