From 10af6f9d82174d35dc8371b7b56ea243464f9626 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Mon, 9 May 2022 18:20:02 -0400 Subject: [PATCH] fix(container): issue with multiple dependencies coming from an output struct (#11912) --- container/container.go | 7 ++++--- container/container_test.go | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/container/container.go b/container/container.go index 700b6b88ceb8..3ced7ff04708 100644 --- a/container/container.go +++ b/container/container.go @@ -214,9 +214,10 @@ func (c *container) addNode(provider *ProviderDescriptor, key *moduleKey) (inter } vr = &simpleResolver{ - node: sp, - typ: typ, - graphNode: typeGraphNode, + node: sp, + typ: typ, + graphNode: typeGraphNode, + idxInValues: i, } c.resolvers[typ] = vr } diff --git a/container/container_test.go b/container/container_test.go index 15d8d1a3b6d9..3eb7e367b121 100644 --- a/container/container_test.go +++ b/container/container_test.go @@ -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 }), ))