]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link/internal: use slices.Contains
authorTobias Klauser <tklauser@distanz.ch>
Thu, 12 Sep 2024 12:47:32 +0000 (14:47 +0200)
committerGopher Robot <gobot@golang.org>
Fri, 13 Sep 2024 16:53:31 +0000 (16:53 +0000)
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>
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/ld/util.go

index 643356d602417cf132999a51fe7b2e7304ce62cf..e43fc11b12095d4b61e700df260dd1b746f518ae 100644 (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 {
index 63b7e0d3299da11b14e6a32a36a2466fb3390558..9873a50dcc3b0d0d528080da5666af438e7b6e42 100644 (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
-}