mirror of https://github.com/golang/go.git
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:
parent
8a4b439ee6
commit
f3c89e21a5
|
|
@ -44,6 +44,7 @@ import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"slices"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
@ -2182,9 +2183,9 @@ func trimLinkerArgv(argv []string) []string {
|
||||||
} else if skip {
|
} else if skip {
|
||||||
skip = false
|
skip = false
|
||||||
} else if f == "" || f[0] != '-' {
|
} else if f == "" || f[0] != '-' {
|
||||||
} else if contains(flagsWithNextArgSkip, f) {
|
} else if slices.Contains(flagsWithNextArgSkip, f) {
|
||||||
skip = true
|
skip = true
|
||||||
} else if contains(flagsWithNextArgKeep, f) {
|
} else if slices.Contains(flagsWithNextArgKeep, f) {
|
||||||
flags = append(flags, f)
|
flags = append(flags, f)
|
||||||
keep = true
|
keep = true
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -105,13 +105,3 @@ func stringtouint32(x []uint32, s string) {
|
||||||
x[i] = binary.LittleEndian.Uint32(buf[:])
|
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
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue