Skip to content

Commit

Permalink
Use 0 as the base when parsing ints
Browse files Browse the repository at this point in the history
To be consistent with what the stdlib flag package does.
  • Loading branch information
jszwedko committed Jan 9, 2015
1 parent 3005aa4 commit 44d4005
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ func (f IntFlag) Apply(set *flag.FlagSet) {
for _, envVar := range strings.Split(f.EnvVar, ",") {
envVar = strings.TrimSpace(envVar)
if envVal := os.Getenv(envVar); envVal != "" {
envValInt, err := strconv.ParseInt(envVal, 10, 64)
envValInt, err := strconv.ParseInt(envVal, 0, 64)
if err == nil {
f.Value = int(envValInt)
break
Expand Down

0 comments on commit 44d4005

Please sign in to comment.