Skip to content

Commit

Permalink
Merge pull request #322 from thockin/parse-int
Browse files Browse the repository at this point in the history
Allow octal and hex values for int flags
  • Loading branch information
k8s-ci-robot authored Jan 7, 2021
2 parents b631e42 + e7eecc3 commit 6f3d9e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/git-sync/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,12 @@ func envBool(key string, def bool) bool {

func envInt(key string, def int) int {
if env := os.Getenv(key); env != "" {
val, err := strconv.Atoi(env)
val, err := strconv.ParseInt(env, 0, 0)
if err != nil {
log.Error(err, "invalid env value, using default", "key", key, "val", os.Getenv(key), "default", def)
return def
}
return val
return int(val)
}
return def
}
Expand Down

0 comments on commit 6f3d9e4

Please sign in to comment.