summaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/tools/go
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-08-10 15:05:54 +0200
committerLibravatar kim <gruf@noreply.codeberg.org>2025-08-10 15:05:54 +0200
commit67100809b399b60e58490fa8b1c0a72be75ac820 (patch)
treeae6df939bf9fe557a766120bee3363f89b47f961 /vendor/golang.org/x/tools/go
parent[feature + performance] add JSON logging format (#4355) (diff)
downloadgotosocial-67100809b399b60e58490fa8b1c0a72be75ac820.tar.xz
[chore] update dependencies (#4361)
- codeberg.org/gruf/go-kv/v2 v2.0.5 => v2.0.6 - github.com/coreos/go-oidc/v3 v3.14.1 => v3.15.0 - github.com/miekg/dns v1.1.67 => v1.1.68 - github.com/tdewolff/minify/v2 v2.23.9 => v2.23.11 - github.com/yuin/goldmark v1.7.12 => v1.7.13 - golang.org/x/crypto v0.40.0 => v0.41.0 - golang.org/x/image v0.29.0 => v0.30.0 - golang.org/x/net v0.42.0 => v0.43.0 - golang.org/x/sys v0.34.0 => v0.35.0 - golang.org/x/text v0.27.0 => v0.28.0 - modernc.org/sqlite v1.38.0 => v1.38.2 Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4361 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'vendor/golang.org/x/tools/go')
-rw-r--r--vendor/golang.org/x/tools/go/packages/golist.go18
-rw-r--r--vendor/golang.org/x/tools/go/packages/golist_overlay.go2
2 files changed, 14 insertions, 6 deletions
diff --git a/vendor/golang.org/x/tools/go/packages/golist.go b/vendor/golang.org/x/tools/go/packages/golist.go
index 96e43cd80..89f89dd2d 100644
--- a/vendor/golang.org/x/tools/go/packages/golist.go
+++ b/vendor/golang.org/x/tools/go/packages/golist.go
@@ -224,13 +224,22 @@ extractQueries:
return response.dr, nil
}
+// abs returns an absolute representation of path, based on cfg.Dir.
+func (cfg *Config) abs(path string) (string, error) {
+ if filepath.IsAbs(path) {
+ return path, nil
+ }
+ // In case cfg.Dir is relative, pass it to filepath.Abs.
+ return filepath.Abs(filepath.Join(cfg.Dir, path))
+}
+
func (state *golistState) runContainsQueries(response *responseDeduper, queries []string) error {
for _, query := range queries {
// TODO(matloob): Do only one query per directory.
fdir := filepath.Dir(query)
// Pass absolute path of directory to go list so that it knows to treat it as a directory,
// not a package path.
- pattern, err := filepath.Abs(fdir)
+ pattern, err := state.cfg.abs(fdir)
if err != nil {
return fmt.Errorf("could not determine absolute path of file= query path %q: %v", query, err)
}
@@ -703,9 +712,8 @@ func (state *golistState) getGoVersion() (int, error) {
// getPkgPath finds the package path of a directory if it's relative to a root
// directory.
func (state *golistState) getPkgPath(dir string) (string, bool, error) {
- absDir, err := filepath.Abs(dir)
- if err != nil {
- return "", false, err
+ if !filepath.IsAbs(dir) {
+ panic("non-absolute dir passed to getPkgPath")
}
roots, err := state.determineRootDirs()
if err != nil {
@@ -715,7 +723,7 @@ func (state *golistState) getPkgPath(dir string) (string, bool, error) {
for rdir, rpath := range roots {
// Make sure that the directory is in the module,
// to avoid creating a path relative to another module.
- if !strings.HasPrefix(absDir, rdir) {
+ if !strings.HasPrefix(dir, rdir) {
continue
}
// TODO(matloob): This doesn't properly handle symlinks.
diff --git a/vendor/golang.org/x/tools/go/packages/golist_overlay.go b/vendor/golang.org/x/tools/go/packages/golist_overlay.go
index d823c474a..d9d5a45cd 100644
--- a/vendor/golang.org/x/tools/go/packages/golist_overlay.go
+++ b/vendor/golang.org/x/tools/go/packages/golist_overlay.go
@@ -55,7 +55,7 @@ func (state *golistState) determineRootDirsModules() (map[string]string, error)
}
if mod.Dir != "" && mod.Path != "" {
// This is a valid module; add it to the map.
- absDir, err := filepath.Abs(mod.Dir)
+ absDir, err := state.cfg.abs(mod.Dir)
if err != nil {
return nil, err
}