cmd/link/internal: use slices.Contains

Change-Id: Ib437e272e0eb7d1b0969a4ed94d264ca3aad7c59
Reviewed-on: https://go-review.googlesource.com/c/go/+/612696
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tim King <taking@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tim King <taking@google.com>
This commit is contained in:
Tobias Klauser 2024-09-12 14:47:32 +02:00 committed by Gopher Robot
parent 8a4b439ee6
commit f3c89e21a5
2 changed files with 3 additions and 12 deletions

View File

@ -44,6 +44,7 @@ import (
"os/exec"
"path/filepath"
"runtime"
"slices"
"sort"
"strings"
"sync"
@ -2182,9 +2183,9 @@ func trimLinkerArgv(argv []string) []string {
} else if skip {
skip = false
} else if f == "" || f[0] != '-' {
} else if contains(flagsWithNextArgSkip, f) {
} else if slices.Contains(flagsWithNextArgSkip, f) {
skip = true
} else if contains(flagsWithNextArgKeep, f) {
} else if slices.Contains(flagsWithNextArgKeep, f) {
flags = append(flags, f)
keep = true
} else {

View File

@ -105,13 +105,3 @@ func stringtouint32(x []uint32, s string) {
x[i] = binary.LittleEndian.Uint32(buf[:])
}
}
// contains reports whether v is in s.
func contains(s []string, v string) bool {
for _, x := range s {
if x == v {
return true
}
}
return false
}