Skip to content

Commit

Permalink
Merge pull request #2 from muir/lint2
Browse files Browse the repository at this point in the history
some changes suggested by lint
  • Loading branch information
muir authored Sep 23, 2021
2 parents 24d383b + f9eb567 commit d56b1bc
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions nject/nject.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,30 +285,30 @@ func newCollection(name string, funcs ...interface{}) *Collection {
}
}

func (p provider) renameIfEmpty(i int, name string) *provider {
if p.origin == "" {
fm := p.copy()
fm.origin = name
if fm.index == -1 {
fm.index = i
func (fm provider) renameIfEmpty(i int, name string) *provider {
if fm.origin == "" {
nfm := fm.copy()
nfm.origin = name
if nfm.index == -1 {
nfm.index = i
}
return fm
return nfm
}
return &p
return &fm
}

func (p provider) flatten() []*provider {
return []*provider{&p}
func (fm provider) flatten() []*provider {
return []*provider{&fm}
}

func (c Collection) flatten() []*provider {
return c.contents
}

func (p provider) modify(f func(*provider)) thing {
fm := p.copy()
f(fm)
return fm
func (fm provider) modify(f func(*provider)) thing {
nfm := fm.copy()
f(nfm)
return nfm
}

func (c Collection) modify(f func(*provider)) thing {
Expand All @@ -324,14 +324,14 @@ func (c Collection) modify(f func(*provider)) thing {
}
}

func (p provider) DownFlows() ([]reflect.Type, []reflect.Type) {
if r, ok := p.fn.(Reflective); ok {
func (fm provider) DownFlows() ([]reflect.Type, []reflect.Type) {
if r, ok := fm.fn.(Reflective); ok {
return effectiveOutputs(reflectiveWrapper{r})
}
if _, ok := p.fn.(generatedFromInjectionChain); ok {
if _, ok := fm.fn.(generatedFromInjectionChain); ok {
return nil, nil
}
v := reflect.ValueOf(p.fn)
v := reflect.ValueOf(fm.fn)
if !v.IsValid() {
return nil, nil
}
Expand Down Expand Up @@ -400,14 +400,14 @@ func (c Collection) DownFlows() ([]reflect.Type, []reflect.Type) {
})
}

func (p provider) UpFlows() ([]reflect.Type, []reflect.Type) {
if r, ok := p.fn.(Reflective); ok {
func (fm provider) UpFlows() ([]reflect.Type, []reflect.Type) {
if r, ok := fm.fn.(Reflective); ok {
return effectiveReturns(reflectiveWrapper{r})
}
if _, ok := p.fn.(generatedFromInjectionChain); ok {
if _, ok := fm.fn.(generatedFromInjectionChain); ok {
return nil, nil
}
v := reflect.ValueOf(p.fn)
v := reflect.ValueOf(fm.fn)
if !v.IsValid() {
return nil, nil
}
Expand Down

0 comments on commit d56b1bc

Please sign in to comment.