Skip to content

Commit 6f3d9e4

Browse files
authored
Merge pull request #322 from thockin/parse-int
Allow octal and hex values for int flags
2 parents b631e42 + e7eecc3 commit 6f3d9e4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/git-sync/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,12 @@ func envBool(key string, def bool) bool {
199199

200200
func envInt(key string, def int) int {
201201
if env := os.Getenv(key); env != "" {
202-
val, err := strconv.Atoi(env)
202+
val, err := strconv.ParseInt(env, 0, 0)
203203
if err != nil {
204204
log.Error(err, "invalid env value, using default", "key", key, "val", os.Getenv(key), "default", def)
205205
return def
206206
}
207-
return val
207+
return int(val)
208208
}
209209
return def
210210
}

0 commit comments

Comments
 (0)