diff options
author | WilczyĆskiT <102859171+WilczynskiT@users.noreply.github.com> | 2022-08-04 19:17:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-04 11:17:35 -0600 |
commit | 2642bd72b7ca35b8622824fdffced2aefe1aaf11 (patch) | |
tree | 3bc73bada610bfee6377eb58d89ca18b72236966 /cmd | |
parent | 17ae5acaba536e98cfa86ddcd6967801f1fa1bbe (diff) |
Replace strings.Index usages with strings.Cut (#4930)
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/main.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cmd/main.go b/cmd/main.go index e932b6b..c475eaa 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -387,11 +387,11 @@ func parseEnvFile(envInput io.Reader) (map[string]string, error) { } // split line into key and value - fields := strings.SplitN(line, "=", 2) - if len(fields) != 2 { + before, after, isCut := strings.Cut(line, "=") + if !isCut { return nil, fmt.Errorf("can't parse line %d; line should be in KEY=VALUE format", lineNumber) } - key, val := fields[0], fields[1] + key, val := before, after // sometimes keys are prefixed by "export " so file can be sourced in bash; ignore it here key = strings.TrimPrefix(key, "export ") |