From e7eecc31a18e265b98ee1bab723b5364f68c2f2d Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Wed, 6 Jan 2021 13:44:01 -0800 Subject: [PATCH] Allow octal and hex values for int flags This is specifcally relevant to --change-permissions. --- cmd/git-sync/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/git-sync/main.go b/cmd/git-sync/main.go index ba8e062..8fb51b7 100644 --- a/cmd/git-sync/main.go +++ b/cmd/git-sync/main.go @@ -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 }