dig icon indicating copy to clipboard operation
dig copied to clipboard

Allow name and group Result Tags

Open jquirke opened this issue 2 years ago • 0 comments

Describe the solution you'd like

This is linked from an Fx feature request: https://github.com/uber-go/fx/issues/998

Furthermore, it is a necessary stepping stone to another Fx feature request https://github.com/uber-go/fx/issues/1036

The restriction on allowing name and group tags seems artificial. For example, this is not permitted:

type Result struct {
    dig.Out
    Foo1 Foo `name:"foo1" group:"foos"`
}

In order to populate by name and groups elsewhere.

Describe alternatives you've considered

An output dig struct can be written with multiple outputs, but that is rather clumsy.

type Result struct {
    dig.Out
    Foo1 Foo `name:"foo1"`
    Foos []Foo `group:"foos"`
}

Is this a breaking change?

Not likely. Since the desired behaviour is not currently permitted, it should not break any existing applications.

jquirke avatar Mar 06 '23 06:03 jquirke