]> Cypherpunks repositories - gostls13.git/commitdiff
io/fs: use slices.Contains
authorqiulaidongfeng <2645477756@qq.com>
Mon, 6 May 2024 09:50:48 +0000 (09:50 +0000)
committerGopher Robot <gobot@golang.org>
Tue, 7 May 2024 18:36:52 +0000 (18:36 +0000)
Change-Id: Ifd91722fd63af89af96a90dd69c73488f7fab5d3
GitHub-Last-Rev: da03963a07201ffca6ae9d50afdab121be8ad208
GitHub-Pull-Request: golang/go#67179
Reviewed-on: https://go-review.googlesource.com/c/go/+/583296
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/io/fs/glob_test.go

index d052eab371366f00a17692774c87fec260b89946..c7c299d081d85ea7d81c93ffe7b16921095fba0a 100644 (file)
@@ -8,6 +8,7 @@ import (
        . "io/fs"
        "os"
        "path"
+       "slices"
        "strings"
        "testing"
 )
@@ -30,7 +31,7 @@ func TestGlob(t *testing.T) {
                        t.Errorf("Glob error for %q: %s", tt.pattern, err)
                        continue
                }
-               if !contains(matches, tt.result) {
+               if !slices.Contains(matches, tt.result) {
                        t.Errorf("Glob(%#q) = %#v want %v", tt.pattern, matches, tt.result)
                }
        }
@@ -65,16 +66,6 @@ func TestCVE202230630(t *testing.T) {
        }
 }
 
-// contains reports whether vector contains the string s.
-func contains(vector []string, s string) bool {
-       for _, elem := range vector {
-               if elem == s {
-                       return true
-               }
-       }
-       return false
-}
-
 type globOnly struct{ GlobFS }
 
 func (globOnly) Open(name string) (File, error) { return nil, ErrNotExist }