From d26559316fa6fae880351637365f07947a2b79f6 Mon Sep 17 00:00:00 2001 From: Chirag Maheshwari <34106488+chir4gm@users.noreply.github.com> Date: Sun, 7 Aug 2022 09:33:37 +0530 Subject: Replace strings.Index with strings.Cut (#4932) --- cmd/main.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'cmd') diff --git a/cmd/main.go b/cmd/main.go index c475eaa..09246f4 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -408,11 +408,8 @@ func parseEnvFile(envInput io.Reader) (map[string]string, error) { } // remove any trailing comment after value - if commentStart := strings.Index(val, "#"); commentStart > 0 { - before := val[commentStart-1] - if before == '\t' || before == ' ' { - val = strings.TrimRight(val[:commentStart], " \t") - } + if commentStart, _, found := strings.Cut(val, "#"); found { + val = strings.TrimRight(commentStart, " \t") } // quoted value: support newlines -- cgit v1.2.3