Use 0 as the base when parsing ints
To be consistent with what the stdlib flag package does.
This commit is contained in:
parent
3005aa4907
commit
44d40054fa
2
flag.go
2
flag.go
@ -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.ParseInt(envVal, 10, 64)
|
envValInt, err := strconv.ParseInt(envVal, 0, 64)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
f.Value = int(envValInt)
|
f.Value = int(envValInt)
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user