From 9482576bb176b32fca1455f7368406cb27937c36 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Tue, 15 Mar 2022 15:48:54 -0700 Subject: [PATCH] ipn/ipnserver: use strings.Cut We now require Go 1.18. Signed-off-by: Josh Bleecher Snyder --- ipn/ipnserver/server.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/ipn/ipnserver/server.go b/ipn/ipnserver/server.go index 656453ff4..47b088100 100644 --- a/ipn/ipnserver/server.go +++ b/ipn/ipnserver/server.go @@ -1179,7 +1179,7 @@ func loadExtraEnv() (env []string, err error) { if line == "" || line[0] == '#' { continue } - k, v, ok := stringsCut(line, "=") + k, v, ok := strings.Cut(line, "=") if !ok || k == "" { continue } @@ -1196,12 +1196,3 @@ func loadExtraEnv() (env []string, err error) { } return env, nil } - -// stringsCut is Go 1.18's strings.Cut. -// TODO(bradfitz): delete this when we depend on Go 1.18. -func stringsCut(s, sep string) (before, after string, found bool) { - if i := strings.Index(s, sep); i >= 0 { - return s[:i], s[i+len(sep):], true - } - return s, "", false -}