Merge pull request #169 from codegangsta/use-0-as-int-base

Use 0 as the base when parsing ints
This commit is contained in:
Dan Buch 2015-01-09 13:13:49 -05:00
commit 97112754e1

View File

@ -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