strconv.ParseInt should be used instead of strconv.ParseUint when reading Int Flags from envvars.

This commit is contained in:
Sam Zaydel 2015-01-09 05:53:14 -08:00
parent aee58516e6
commit ef23aa6da2

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.ParseUint(envVal, 10, 64)
envValInt, err := strconv.ParseInt(envVal, 10, 64)
if err == nil {
f.Value = int(envValInt)
break