From c94f92118fc8c8418dee888128e8895129047de0 Mon Sep 17 00:00:00 2001 From: Sung Yoon Whang Date: Wed, 24 Aug 2022 10:47:49 -0700 Subject: [PATCH] Fix incorrect documentation on soft value group --- inout.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/inout.go b/inout.go index ffc709124..74125048f 100644 --- a/inout.go +++ b/inout.go @@ -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 // } // @@ -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.