Skip to content

Commit

Permalink
Merge pull request #56 from ravenpride/shadowing
Browse files Browse the repository at this point in the history
Fix variable shadowing issue in setValueForParsers()
  • Loading branch information
integrii authored Nov 2, 2019
2 parents 3e75a52 + d6fd483 commit eb3db4b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions argumentParser.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,17 @@ package flaggy
// as we find a parser that accepts it.
func setValueForParsers(key string, value string, parsers ...ArgumentParser) (bool, error) {

var valueWasSet bool

for _, p := range parsers {
valueWasSet, err := p.SetValueForKey(key, value)
if err != nil {
return valueWasSet, err
}
if valueWasSet {
break
return true, nil
}
}

return valueWasSet, nil
return false, nil
}

// ArgumentParser represents a parser or subcommand
Expand Down

0 comments on commit eb3db4b

Please sign in to comment.