Skip to content

Commit

Permalink
fix(container): issue with multiple dependencies coming from an outpu…
Browse files Browse the repository at this point in the history
…t struct
  • Loading branch information
aaronc committed May 9, 2022
1 parent 324da02 commit b3dc113
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 4 additions & 2 deletions container/container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ type TestOutput struct {
container.Out

X string
Y int64
}

func TestStructArgs(t *testing.T) {
Expand All @@ -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
}),
))

Expand Down

0 comments on commit b3dc113

Please sign in to comment.