Skip to content

Commit

Permalink
Fix incorrect documentation on soft value group (#932)
Browse files Browse the repository at this point in the history
  • Loading branch information
sywhang committed Aug 24, 2022
1 parent 5566339 commit a3d266e
Showing 1 changed file with 6 additions and 5 deletions.
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

0 comments on commit a3d266e

Please sign in to comment.