Merge pull request #168 from szaydel/fixParseUint-Flag

strconv.ParseInt should be used instead of strconv.ParseUint when readin...
This commit is contained in:
Jesse Szwedko 2015-01-09 13:10:19 -05:00
commit 3005aa4907

View File

@ -338,7 +338,7 @@ func (f IntFlag) Apply(set *flag.FlagSet) {
for _, envVar := range strings.Split(f.EnvVar, ",") { for _, envVar := range strings.Split(f.EnvVar, ",") {
envVar = strings.TrimSpace(envVar) envVar = strings.TrimSpace(envVar)
if envVal := os.Getenv(envVar); envVal != "" { if envVal := os.Getenv(envVar); envVal != "" {
envValInt, err := strconv.ParseUint(envVal, 10, 64) envValInt, err := strconv.ParseInt(envVal, 10, 64)
if err == nil { if err == nil {
f.Value = int(envValInt) f.Value = int(envValInt)
break break