all: update to Go 1.20, use strings.CutPrefix/Suffix instead of our fork

Updates #7123
Updates #5309

Change-Id: I90bcd87a2fb85a91834a0dd4be6e03db08438672
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2023-02-01 13:43:06 -08:00
committed by Brad Fitzpatrick
parent 623176ebc9
commit b1248442c3
34 changed files with 73 additions and 147 deletions

View File

@@ -14,8 +14,6 @@ import (
"path"
"path/filepath"
"strings"
"tailscale.com/util/strs"
)
// CmdName returns either the base name of the current binary
@@ -42,7 +40,7 @@ func cmdName(exe string) string {
// v is like:
// "path\ttailscale.com/cmd/tailscale\nmod\ttailscale.com\t(devel)\t\ndep\tgithub.com/apenwarr/fixconsole\tv0.0.0-20191012055117-5a9f6489cc29\th1:muXWUcay7DDy1/hEQWrYlBy+g0EuwT70sBHg65SeUc4=\ndep\tgithub....
for _, line := range strings.Split(info, "\n") {
if goPkg, ok := strs.CutPrefix(line, "path\t"); ok { // like "tailscale.com/cmd/tailscale"
if goPkg, ok := strings.CutPrefix(line, "path\t"); ok { // like "tailscale.com/cmd/tailscale"
ret = path.Base(goPkg) // goPkg is always forward slashes; use path, not filepath
break
}