Skip to content

Commit

Permalink
gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
sywhang committed Aug 4, 2022
1 parent 818c88f commit 01e82b1
Showing 1 changed file with 54 additions and 54 deletions.
108 changes: 54 additions & 54 deletions inout.go
Expand Up @@ -169,70 +169,70 @@ import "go.uber.org/dig"
// A soft group will be populated only with values from already-executed
// constructors.
//
// type Params struct {
// fx.In
// type Params struct {
// fx.In
//
// Handlers []Handler `group:"server"`
// Logger *zap.Logger
// }
// Handlers []Handler `group:"server"`
// Logger *zap.Logger
// }
//
// NewHandlerAndLogger := func() (Handler, *zap.Logger) { ... }
// NewHandler := func() Handler { ... }
// Foo := func(Params) { ... }
// NewHandlerAndLogger := func() (Handler, *zap.Logger) { ... }
// NewHandler := func() Handler { ... }
// Foo := func(Params) { ... }
//
// app := fx.New(
// fx.Provide(NewHandlerAndLogger),
// fx.Provide(NewHandler),
// fx.Invoke(Foo),
// )
// app := fx.New(
// fx.Provide(NewHandlerAndLogger),
// fx.Provide(NewHandler),
// fx.Invoke(Foo),
// )
//
// The only constructor called is `NewHandler`, because this also provides
// `*zap.Logger` needed in the `Params` struct received by `foo`
//
// In the next example, the slice `s` isn't populated as the provider would be
// called only because of `strings` soft group value
//
// app := fx.New(
// fx.Provide(
// fx.Annotate(
// func() (string,int) { return "hello" },
// fx.ResultTags(`group:"strings"`),
// ),
// ),
// fx.Invoke(
// fx.Annotate(func(s []string) {
// // s will be an empty slice
// },
// fx.ParamTags(`group:"strings,soft"`),
// ),
// ),
// )
//
// In the next example, the slice `s` will be populated because there is a
// consumer for the same type which hasn't a `soft` dependency
//
// app := fx.New(
// fx.Provide(
// fx.Annotate(
// func() string { "hello" },
// fx.ResultTags(`group:"strings"`),
// ),
// ),
// fx.Invoke(
// fx.Annotate(func(b []string) {
// // b will be ["hello"]
// },
// fx.ParamTags(`group:"strings"`),
// ),
// ),
// fx.Invoke(
// fx.Annotate(func(s []string) {
// // s will be ["hello"]
// },
// fx.ParamTags(`group:"strings,soft"`),
// ),
// ),
// )
// app := fx.New(
// fx.Provide(
// fx.Annotate(
// func() (string,int) { return "hello" },
// fx.ResultTags(`group:"strings"`),
// ),
// ),
// fx.Invoke(
// fx.Annotate(func(s []string) {
// // s will be an empty slice
// },
// fx.ParamTags(`group:"strings,soft"`),
// ),
// ),
// )
//
// In the next example, the slice `s` will be populated because there is a
// consumer for the same type which hasn't a `soft` dependency
//
// app := fx.New(
// fx.Provide(
// fx.Annotate(
// func() string { "hello" },
// fx.ResultTags(`group:"strings"`),
// ),
// ),
// fx.Invoke(
// fx.Annotate(func(b []string) {
// // b will be ["hello"]
// },
// fx.ParamTags(`group:"strings"`),
// ),
// ),
// fx.Invoke(
// fx.Annotate(func(s []string) {
// // s will be ["hello"]
// },
// fx.ParamTags(`group:"strings,soft"`),
// ),
// ),
// )
//
// # Unexported fields
//
Expand Down

0 comments on commit 01e82b1

Please sign in to comment.