fix(container): issue with multiple dependencies coming from an output struct (#11912)

This commit is contained in:
Aaron Craelius 2022-05-09 18:20:02 -04:00 committed by GitHub
parent 324da02ba9
commit 10af6f9d82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -217,6 +217,7 @@ func (c *container) addNode(provider *ProviderDescriptor, key *moduleKey) (inter
node: sp,
typ: typ,
graphNode: typeGraphNode,
idxInValues: i,
}
c.resolvers[typ] = vr
}

View File

@ -461,6 +461,7 @@ type TestOutput struct {
container.Out
X string
Y int64
}
func TestStructArgs(t *testing.T) {
@ -485,11 +486,12 @@ func TestStructArgs(t *testing.T) {
))
require.NoError(t, container.Run(
func(x string) {
func(x string, y int64) {
require.Equal(t, "A", x)
require.Equal(t, int64(-10), y)
},
container.Provide(func() (TestOutput, error) {
return TestOutput{X: "A"}, nil
return TestOutput{X: "A", Y: -10}, nil
}),
))