...SplitN, not SplitAfterN

This commit is contained in:
brent s. 2021-12-18 04:46:43 -05:00
parent cf67bec392
commit 008ed531a2
Signed by: bts
GPG Key ID: 8C004C2F93481F6B
2 changed files with 3 additions and 3 deletions

View File

@ -16,8 +16,8 @@ func envListToMap(envs []string) (envMap map[string]string) {
envMap = make(map[string]string, 0) envMap = make(map[string]string, 0)


for _, ev := range envs { for _, ev := range envs {
kv = strings.SplitAfterN(ev, "=", 2) kv = strings.SplitN(ev, "=", 2)
// I *think* SplitAfterN does this for me, but... // I *think* SplitN does this for me, but...
if len(kv) == 1 { if len(kv) == 1 {
kv = append(kv, "") kv = append(kv, "")
} }

View File

@ -62,7 +62,7 @@ func ExpandHome(path *string) (err error) {
} }
*/ */
// K but do it smarter. // K but do it smarter.
unameSplit = strings.SplitAfterN(*path, string(os.PathSeparator), 2) unameSplit = strings.SplitN(*path, string(os.PathSeparator), 2)
if len(unameSplit) != 2 { if len(unameSplit) != 2 {
unameSplit = append(unameSplit, "") unameSplit = append(unameSplit, "")
} }