From df6fa62a57a4cdadb141803df472c98aaede1098 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 24 Sep 2021 15:29:10 -0400 Subject: [PATCH] fixes --- container/container.go | 2 +- container/go.mod | 9 +++++++++ container/scope_dep.go | 10 +++++----- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/container/container.go b/container/container.go index a79e24c9846..8d85213db87 100644 --- a/container/container.go +++ b/container/container.go @@ -169,7 +169,7 @@ func (c *container) addNode(constructor *ProviderDescriptor, scope Scope, noLog c.logf("Registering scope provider: %s", constructor.Location.String()) } node := &scopeDepProvider{ - ctr: constructor, + provider: constructor, calledForScope: map[Scope]bool{}, valueMap: map[Scope][]reflect.Value{}, } diff --git a/container/go.mod b/container/go.mod index 9b892b40ce1..d7128697a57 100644 --- a/container/go.mod +++ b/container/go.mod @@ -7,3 +7,12 @@ require ( github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.7.0 ) + +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/fogleman/gg v1.3.0 // indirect + github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + golang.org/x/image v0.0.0-20200119044424-58c23975cae1 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) diff --git a/container/scope_dep.go b/container/scope_dep.go index dc8048c63c1..4ffdb83f758 100644 --- a/container/scope_dep.go +++ b/container/scope_dep.go @@ -5,7 +5,7 @@ import ( ) type scopeDepProvider struct { - provider *ProviderDescriptor + provider *ProviderDescriptor calledForScope map[Scope]bool valueMap map[Scope][]reflect.Value } @@ -18,12 +18,12 @@ type scopeDepResolver struct { } func (s scopeDepResolver) describeLocation() string { - return s.node.ctr.Location.String() + return s.node.provider.Location.String() } func (s scopeDepResolver) resolve(ctr *container, scope Scope, caller Location) (reflect.Value, error) { // Log - ctr.logf("Providing %v from %s to %s", s.typ, s.node.ctr.Location, caller.Name()) + ctr.logf("Providing %v from %s to %s", s.typ, s.node.provider.Location, caller.Name()) // Resolve if val, ok := s.valueMap[scope]; ok { @@ -31,7 +31,7 @@ func (s scopeDepResolver) resolve(ctr *container, scope Scope, caller Location) } if !s.node.calledForScope[scope] { - values, err := ctr.call(s.node.ctr, scope) + values, err := ctr.call(s.node.provider, scope) if err != nil { return reflect.Value{}, err } @@ -46,5 +46,5 @@ func (s scopeDepResolver) resolve(ctr *container, scope Scope, caller Location) } func (s scopeDepResolver) addNode(p *simpleProvider, _ int, _ *container) error { - return duplicateDefinitionError(s.typ, p.provider.Location, s.node.ctr.Location.String()) + return duplicateDefinitionError(s.typ, p.provider.Location, s.node.provider.Location.String()) }