Skip to content

Commit

Permalink
nit fix
Browse files Browse the repository at this point in the history
  • Loading branch information
anuptalwalkar committed May 19, 2017
1 parent be0d202 commit f0a8c33
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -7,7 +7,7 @@
- Remove `*All` funcs to reduce API surface area. Available methods on
container are `Provide`, `Resolve` and `Invoke`
- Providing constructors with common returned types results in an error.
- Add `InvokOnce` functionality to invoke only once on unresolved return types
- Add `InvokeOnce` functionality to invoke only once on unresolved return types
of the provided function

## v0.3 (2 May 2017)
Expand Down
1 change: 1 addition & 0 deletions container_test.go
Expand Up @@ -380,6 +380,7 @@ func TestInvokeOnce(t *testing.T) {
}

func TestInvokeOnceFailOnResolvedTypes(t *testing.T) {
t.Parallel()
c := New()
c.Provide(newT1, newT2, newT3)
require.NoError(t, c.InvokeOnce(newT1))
Expand Down
6 changes: 3 additions & 3 deletions internal/graph/graph.go
Expand Up @@ -138,15 +138,15 @@ func (g *Graph) InsertConstructor(ctor interface{}) error {
}

// ValidateInvokeReturnTypes validates Invoke return types and returns an error
// if the grah node of return type is resolved and cached.
// if the graph node of return type is resolved and cached.
func (g *Graph) ValidateInvokeReturnTypes(ctype reflect.Type) error {
if err := g.checkDuplicateReturns(ctype); err != nil {
return err
}
for i := 0; i < ctype.NumOut(); i++ {
objType := ctype.Out(i)
if _, ok := g.nodes[objType]; ok {
if obj, ok := g.nodes[objType].(*objNode); ok && obj.cached {
if node, ok := g.nodes[objType]; ok {
if obj, ok := node.(*objNode); ok && obj.cached {
return errors.Wrapf(errRetNode, "ctor: %v, object type: %v", ctype, objType)
}
}
Expand Down

0 comments on commit f0a8c33

Please sign in to comment.