summaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/tools/go/packages/external.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2025-01-14 13:11:20 +0000
committerLibravatar GitHub <noreply@github.com>2025-01-14 13:11:20 +0000
commitb95498b8c206295b55767fa2d4855bee16233734 (patch)
treef8b95d8b5bdbcc062915ae4b59c7a6488fe9da90 /vendor/golang.org/x/tools/go/packages/external.go
parent[chore]: Bump github.com/gin-contrib/gzip from 1.0.1 to 1.1.0 (#3639) (diff)
downloadgotosocial-b95498b8c206295b55767fa2d4855bee16233734.tar.xz
[chore]: Bump mvdan.cc/xurls/v2 from 2.5.0 to 2.6.0 (#3643)
Bumps [mvdan.cc/xurls/v2](https://github.com/mvdan/xurls) from 2.5.0 to 2.6.0. - [Release notes](https://github.com/mvdan/xurls/releases) - [Commits](https://github.com/mvdan/xurls/compare/v2.5.0...v2.6.0) --- updated-dependencies: - dependency-name: mvdan.cc/xurls/v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/golang.org/x/tools/go/packages/external.go')
-rw-r--r--vendor/golang.org/x/tools/go/packages/external.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/vendor/golang.org/x/tools/go/packages/external.go b/vendor/golang.org/x/tools/go/packages/external.go
index c2b4b711b..91bd62e83 100644
--- a/vendor/golang.org/x/tools/go/packages/external.go
+++ b/vendor/golang.org/x/tools/go/packages/external.go
@@ -13,6 +13,7 @@ import (
"fmt"
"os"
"os/exec"
+ "slices"
"strings"
)
@@ -79,10 +80,10 @@ type DriverResponse struct {
// driver is the type for functions that query the build system for the
// packages named by the patterns.
-type driver func(cfg *Config, patterns ...string) (*DriverResponse, error)
+type driver func(cfg *Config, patterns []string) (*DriverResponse, error)
// findExternalDriver returns the file path of a tool that supplies
-// the build system package structure, or "" if not found."
+// the build system package structure, or "" if not found.
// If GOPACKAGESDRIVER is set in the environment findExternalTool returns its
// value, otherwise it searches for a binary named gopackagesdriver on the PATH.
func findExternalDriver(cfg *Config) driver {
@@ -103,7 +104,7 @@ func findExternalDriver(cfg *Config) driver {
return nil
}
}
- return func(cfg *Config, words ...string) (*DriverResponse, error) {
+ return func(cfg *Config, patterns []string) (*DriverResponse, error) {
req, err := json.Marshal(DriverRequest{
Mode: cfg.Mode,
Env: cfg.Env,
@@ -117,7 +118,7 @@ func findExternalDriver(cfg *Config) driver {
buf := new(bytes.Buffer)
stderr := new(bytes.Buffer)
- cmd := exec.CommandContext(cfg.Context, tool, words...)
+ cmd := exec.CommandContext(cfg.Context, tool, patterns...)
cmd.Dir = cfg.Dir
// The cwd gets resolved to the real path. On Darwin, where
// /tmp is a symlink, this breaks anything that expects the
@@ -131,7 +132,7 @@ func findExternalDriver(cfg *Config) driver {
// command.
//
// (See similar trick in Invocation.run in ../../internal/gocommand/invoke.go)
- cmd.Env = append(slicesClip(cfg.Env), "PWD="+cfg.Dir)
+ cmd.Env = append(slices.Clip(cfg.Env), "PWD="+cfg.Dir)
cmd.Stdin = bytes.NewReader(req)
cmd.Stdout = buf
cmd.Stderr = stderr
@@ -150,7 +151,3 @@ func findExternalDriver(cfg *Config) driver {
return &response, nil
}
}
-
-// slicesClip removes unused capacity from the slice, returning s[:len(s):len(s)].
-// TODO(adonovan): use go1.21 slices.Clip.
-func slicesClip[S ~[]E, E any](s S) S { return s[:len(s):len(s)] }