]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: delete cmd/go/internal/slices in favor of slices
authorRuss Cox <rsc@golang.org>
Wed, 31 May 2023 20:45:03 +0000 (16:45 -0400)
committerGopher Robot <gobot@golang.org>
Thu, 1 Jun 2023 02:52:19 +0000 (02:52 +0000)
Some files already use "slices", others use "cmd/go/internal/slices".
(Some files are using more than slices.Clip and must use "slices".)
Use "slices" consistently and delete cmd/go/internal/slices.

Change-Id: I69ec680106ad2924276f7473e6547a3a907efc96
Reviewed-on: https://go-review.googlesource.com/c/go/+/499715
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>

src/cmd/go/internal/generate/generate.go
src/cmd/go/internal/modload/init.go
src/cmd/go/internal/modload/query.go
src/cmd/go/internal/mvs/graph.go
src/cmd/go/internal/slices/slices.go [deleted file]
src/cmd/go/internal/test/test.go
src/cmd/go/internal/vcweb/git.go
src/cmd/go/internal/vcweb/hg.go
src/cmd/go/internal/work/exec.go

index 50c6892479750231e5d273487faae2d533453d35..f1f4a6cf30de0853933e009e18504d4fa1d701ff 100644 (file)
@@ -18,6 +18,7 @@ import (
        "os/exec"
        "path/filepath"
        "regexp"
+       "slices"
        "strconv"
        "strings"
 
@@ -25,7 +26,6 @@ import (
        "cmd/go/internal/cfg"
        "cmd/go/internal/load"
        "cmd/go/internal/modload"
-       "cmd/go/internal/slices"
        "cmd/go/internal/str"
        "cmd/go/internal/work"
 )
index 6377e19856316c69973758952380c5af8090c199..8840188c26f8b8d1b3bba8845708001ed0d2817e 100644 (file)
@@ -14,6 +14,7 @@ import (
        "os"
        "path"
        "path/filepath"
+       "slices"
        "strconv"
        "strings"
        "sync"
@@ -26,7 +27,6 @@ import (
        "cmd/go/internal/modconv"
        "cmd/go/internal/modfetch"
        "cmd/go/internal/search"
-       "cmd/go/internal/slices"
 
        "golang.org/x/mod/modfile"
        "golang.org/x/mod/module"
index b26a036cacfcee4ec7a7baebf54f98a02e39de19..945b6e1642d97960eca35b1032c457cfb7e37824 100644 (file)
@@ -12,6 +12,7 @@ import (
        "io/fs"
        "os"
        pathpkg "path"
+       "slices"
        "sort"
        "strings"
        "sync"
@@ -24,7 +25,6 @@ import (
        "cmd/go/internal/modfetch/codehost"
        "cmd/go/internal/modinfo"
        "cmd/go/internal/search"
-       "cmd/go/internal/slices"
        "cmd/go/internal/str"
        "cmd/go/internal/trace"
        "cmd/internal/pkgpattern"
index 6d6e6f584d429b9d51995866497966797983b233..56b3c604eb1b9b5a5ecfb842003ab48d8581fd47 100644 (file)
@@ -5,9 +5,10 @@
 package mvs
 
 import (
-       "cmd/go/internal/gover"
-       "cmd/go/internal/slices"
        "fmt"
+       "slices"
+
+       "cmd/go/internal/gover"
 
        "golang.org/x/mod/module"
 )
diff --git a/src/cmd/go/internal/slices/slices.go b/src/cmd/go/internal/slices/slices.go
deleted file mode 100644 (file)
index a0adcf4..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2023 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// TODO: Replace with slices package when it lands in standard library.
-
-package slices
-
-// Clip removes unused capacity from the slice, returning s[:len(s):len(s)].
-func Clip[S ~[]E, E any](s S) S {
-       return s[:len(s):len(s)]
-}
index 31ae79c80d285396803e4e89d2f28dda83f7e1c2..95391c58c7e92f98ee0dc27e5eca7c09edb572a9 100644 (file)
@@ -16,6 +16,7 @@ import (
        "os/exec"
        "path/filepath"
        "regexp"
+       "slices"
        "strconv"
        "strings"
        "sync"
@@ -28,7 +29,6 @@ import (
        "cmd/go/internal/lockedfile"
        "cmd/go/internal/modload"
        "cmd/go/internal/search"
-       "cmd/go/internal/slices"
        "cmd/go/internal/str"
        "cmd/go/internal/trace"
        "cmd/go/internal/work"
index 2168d5215683388643cd11fb4922133b545cd13d..316c2382ba2b352eae62fee0e3a0661011badfac 100644 (file)
@@ -5,12 +5,12 @@
 package vcweb
 
 import (
-       "cmd/go/internal/slices"
        "log"
        "net/http"
        "net/http/cgi"
        "os/exec"
        "runtime"
+       "slices"
        "sync"
 )
 
index 3c45acab3e9f37ad0b8fbee84b046b1146f01398..4571277c9f1a5a4bfd9235ed3582363dda02347a 100644 (file)
@@ -6,7 +6,6 @@ package vcweb
 
 import (
        "bufio"
-       "cmd/go/internal/slices"
        "context"
        "errors"
        "io"
@@ -16,6 +15,7 @@ import (
        "net/url"
        "os"
        "os/exec"
+       "slices"
        "strings"
        "sync"
        "time"
index 998d0007d012e4cc8d7ec96814f0a3517ac294ae..a570e755ebb412d46e0b5abb851ed0e1455d4285 100644 (file)
@@ -25,6 +25,7 @@ import (
        "path/filepath"
        "regexp"
        "runtime"
+       "slices"
        "sort"
        "strconv"
        "strings"
@@ -38,7 +39,6 @@ import (
        "cmd/go/internal/gover"
        "cmd/go/internal/load"
        "cmd/go/internal/modload"
-       "cmd/go/internal/slices"
        "cmd/go/internal/str"
        "cmd/go/internal/trace"
        "cmd/internal/buildid"