mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-05 08:03:55 -04:00
chore(deps): bump github.com/onsi/gomega from 1.33.1 to 1.34.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.33.1 to 1.34.1. - [Release notes](https://github.com/onsi/gomega/releases) - [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md) - [Commits](https://github.com/onsi/gomega/compare/v1.33.1...v1.34.1) --- updated-dependencies: - dependency-name: github.com/onsi/gomega dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
Ralf Haferkamp
parent
ba7e67f73b
commit
f2c5077289
8
go.mod
8
go.mod
@@ -68,7 +68,7 @@ require (
|
||||
github.com/olekukonko/tablewriter v0.0.5
|
||||
github.com/onsi/ginkgo v1.16.5
|
||||
github.com/onsi/ginkgo/v2 v2.19.0
|
||||
github.com/onsi/gomega v1.33.1
|
||||
github.com/onsi/gomega v1.34.1
|
||||
github.com/open-policy-agent/opa v0.67.1
|
||||
github.com/orcaman/concurrent-map v1.0.0
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20240618162722-2298241331d1
|
||||
@@ -102,7 +102,7 @@ require (
|
||||
go.opentelemetry.io/otel/sdk v1.28.0
|
||||
go.opentelemetry.io/otel/trace v1.28.0
|
||||
golang.org/x/crypto v0.25.0
|
||||
golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3
|
||||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
|
||||
golang.org/x/image v0.18.0
|
||||
golang.org/x/net v0.27.0
|
||||
golang.org/x/oauth2 v0.22.0
|
||||
@@ -341,10 +341,10 @@ require (
|
||||
go.uber.org/atomic v1.11.0 // indirect
|
||||
go.uber.org/multierr v1.9.0 // indirect
|
||||
go.uber.org/zap v1.23.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/mod v0.19.0 // indirect
|
||||
golang.org/x/sys v0.23.0 // indirect
|
||||
golang.org/x/time v0.5.0 // indirect
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
|
||||
golang.org/x/tools v0.23.0 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
|
||||
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240723171418-e6d459c13d2a // indirect
|
||||
|
||||
16
go.sum
16
go.sum
@@ -931,8 +931,8 @@ github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0
|
||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||
github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk=
|
||||
github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0=
|
||||
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
|
||||
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
|
||||
github.com/open-policy-agent/opa v0.67.1 h1:rzy26J6g1X+CKknAcx0Vfbt41KqjuSzx4E0A8DAZf3E=
|
||||
github.com/open-policy-agent/opa v0.67.1/go.mod h1:aqKlHc8E2VAAylYE9x09zJYr/fYzGX+JKne89UGqFzk=
|
||||
github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg=
|
||||
@@ -1315,8 +1315,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
|
||||
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||
golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 h1:/RIbNt/Zr7rVhIkQhooTxCxFcdWLGIKnZA4IXNFSrvo=
|
||||
golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08=
|
||||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
|
||||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ=
|
||||
@@ -1342,8 +1342,8 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
|
||||
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8=
|
||||
golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@@ -1610,8 +1610,8 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f
|
||||
golang.org/x/tools v0.0.0-20210112230658-8b4aab62c064/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
|
||||
golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg=
|
||||
golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
||||
22
vendor/github.com/onsi/gomega/CHANGELOG.md
generated
vendored
22
vendor/github.com/onsi/gomega/CHANGELOG.md
generated
vendored
@@ -1,3 +1,25 @@
|
||||
## 1.34.1
|
||||
|
||||
### Maintenance
|
||||
- Use slices from exp/slices to keep golang 1.20 compat [5e71dcd]
|
||||
|
||||
## 1.34.0
|
||||
|
||||
### Features
|
||||
- Add RoundTripper method to ghttp.Server [c549e0d]
|
||||
|
||||
### Fixes
|
||||
- fix incorrect handling of nil slices in HaveExactElements (fixes #771) [878940c]
|
||||
- issue_765 - fixed bug in Hopcroft-Karp algorithm [ebadb67]
|
||||
|
||||
### Maintenance
|
||||
- bump ginkgo [8af2ece]
|
||||
- Fix typo in docs [123a071]
|
||||
- Bump github.com/onsi/ginkgo/v2 from 2.17.2 to 2.17.3 (#756) [0e69083]
|
||||
- Bump google.golang.org/protobuf from 1.33.0 to 1.34.1 (#755) [2675796]
|
||||
- Bump golang.org/x/net from 0.24.0 to 0.25.0 (#754) [4160c0f]
|
||||
- Bump github-pages from 230 to 231 in /docs (#748) [892c303]
|
||||
|
||||
## 1.33.1
|
||||
|
||||
### Fixes
|
||||
|
||||
2
vendor/github.com/onsi/gomega/gomega_dsl.go
generated
vendored
2
vendor/github.com/onsi/gomega/gomega_dsl.go
generated
vendored
@@ -22,7 +22,7 @@ import (
|
||||
"github.com/onsi/gomega/types"
|
||||
)
|
||||
|
||||
const GOMEGA_VERSION = "1.33.1"
|
||||
const GOMEGA_VERSION = "1.34.1"
|
||||
|
||||
const nilGomegaPanic = `You are trying to make an assertion, but haven't registered Gomega's fail handler.
|
||||
If you're using Ginkgo then you probably forgot to put your assertion in an It().
|
||||
|
||||
7
vendor/github.com/onsi/gomega/matchers/have_exact_elements.go
generated
vendored
7
vendor/github.com/onsi/gomega/matchers/have_exact_elements.go
generated
vendored
@@ -30,15 +30,18 @@ func (matcher *HaveExactElementsMatcher) Match(actual interface{}) (success bool
|
||||
|
||||
lenMatchers := len(matchers)
|
||||
lenValues := len(values)
|
||||
success = true
|
||||
|
||||
for i := 0; i < lenMatchers || i < lenValues; i++ {
|
||||
if i >= lenMatchers {
|
||||
matcher.extraIndex = i
|
||||
success = false
|
||||
continue
|
||||
}
|
||||
|
||||
if i >= lenValues {
|
||||
matcher.missingIndex = i
|
||||
success = false
|
||||
return
|
||||
}
|
||||
|
||||
@@ -49,15 +52,17 @@ func (matcher *HaveExactElementsMatcher) Match(actual interface{}) (success bool
|
||||
index: i,
|
||||
failure: err.Error(),
|
||||
})
|
||||
success = false
|
||||
} else if !match {
|
||||
matcher.mismatchFailures = append(matcher.mismatchFailures, mismatchFailure{
|
||||
index: i,
|
||||
failure: elemMatcher.FailureMessage(values[i]),
|
||||
})
|
||||
success = false
|
||||
}
|
||||
}
|
||||
|
||||
return matcher.missingIndex+matcher.extraIndex+len(matcher.mismatchFailures) == 0, nil
|
||||
return success, nil
|
||||
}
|
||||
|
||||
func (matcher *HaveExactElementsMatcher) FailureMessage(actual interface{}) (message string) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package bipartitegraph
|
||||
|
||||
import (
|
||||
"golang.org/x/exp/slices"
|
||||
|
||||
. "github.com/onsi/gomega/matchers/support/goraph/edge"
|
||||
. "github.com/onsi/gomega/matchers/support/goraph/node"
|
||||
"github.com/onsi/gomega/matchers/support/goraph/util"
|
||||
@@ -157,6 +159,11 @@ func (bg *BipartiteGraph) createSLAPGuideLayers(matching EdgeSet) (guideLayers [
|
||||
if len(currentLayer) == 0 {
|
||||
return []NodeOrderedSet{}
|
||||
}
|
||||
if done { // if last layer - into last layer must be only 'free' nodes
|
||||
currentLayer = slices.DeleteFunc(currentLayer, func(in Node) bool {
|
||||
return !matching.Free(in)
|
||||
})
|
||||
}
|
||||
guideLayers = append(guideLayers, currentLayer)
|
||||
}
|
||||
|
||||
|
||||
4
vendor/golang.org/x/exp/LICENSE
generated
vendored
4
vendor/golang.org/x/exp/LICENSE
generated
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2009 The Go Authors. All rights reserved.
|
||||
Copyright 2009 The Go Authors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
@@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer.
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
* Neither the name of Google LLC nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
|
||||
4
vendor/golang.org/x/exp/slices/sort.go
generated
vendored
4
vendor/golang.org/x/exp/slices/sort.go
generated
vendored
@@ -22,10 +22,12 @@ func Sort[S ~[]E, E constraints.Ordered](x S) {
|
||||
// SortFunc sorts the slice x in ascending order as determined by the cmp
|
||||
// function. This sort is not guaranteed to be stable.
|
||||
// cmp(a, b) should return a negative number when a < b, a positive number when
|
||||
// a > b and zero when a == b.
|
||||
// a > b and zero when a == b or when a is not comparable to b in the sense
|
||||
// of the formal definition of Strict Weak Ordering.
|
||||
//
|
||||
// SortFunc requires that cmp is a strict weak ordering.
|
||||
// See https://en.wikipedia.org/wiki/Weak_ordering#Strict_weak_orderings.
|
||||
// To indicate 'uncomparable', return 0 from the function.
|
||||
func SortFunc[S ~[]E, E any](x S, cmp func(a, b E) int) {
|
||||
n := len(x)
|
||||
pdqsortCmpFunc(x, 0, n, bits.Len(uint(n)), cmp)
|
||||
|
||||
24
vendor/golang.org/x/tools/go/ast/astutil/enclosing.go
generated
vendored
24
vendor/golang.org/x/tools/go/ast/astutil/enclosing.go
generated
vendored
@@ -106,8 +106,21 @@ func PathEnclosingInterval(root *ast.File, start, end token.Pos) (path []ast.Nod
|
||||
|
||||
// Does augmented child strictly contain [start, end)?
|
||||
if augPos <= start && end <= augEnd {
|
||||
_, isToken := child.(tokenNode)
|
||||
return isToken || visit(child)
|
||||
if is[tokenNode](child) {
|
||||
return true
|
||||
}
|
||||
|
||||
// childrenOf elides the FuncType node beneath FuncDecl.
|
||||
// Add it back here for TypeParams, Params, Results,
|
||||
// all FieldLists). But we don't add it back for the "func" token
|
||||
// even though it is is the tree at FuncDecl.Type.Func.
|
||||
if decl, ok := node.(*ast.FuncDecl); ok {
|
||||
if fields, ok := child.(*ast.FieldList); ok && fields != decl.Recv {
|
||||
path = append(path, decl.Type)
|
||||
}
|
||||
}
|
||||
|
||||
return visit(child)
|
||||
}
|
||||
|
||||
// Does [start, end) overlap multiple children?
|
||||
@@ -313,6 +326,8 @@ func childrenOf(n ast.Node) []ast.Node {
|
||||
//
|
||||
// As a workaround, we inline the case for FuncType
|
||||
// here and order things correctly.
|
||||
// We also need to insert the elided FuncType just
|
||||
// before the 'visit' recursion.
|
||||
//
|
||||
children = nil // discard ast.Walk(FuncDecl) info subtrees
|
||||
children = append(children, tok(n.Type.Func, len("func")))
|
||||
@@ -632,3 +647,8 @@ func NodeDescription(n ast.Node) string {
|
||||
}
|
||||
panic(fmt.Sprintf("unexpected node type: %T", n))
|
||||
}
|
||||
|
||||
func is[T any](x any) bool {
|
||||
_, ok := x.(T)
|
||||
return ok
|
||||
}
|
||||
|
||||
1
vendor/golang.org/x/tools/go/ast/astutil/util.go
generated
vendored
1
vendor/golang.org/x/tools/go/ast/astutil/util.go
generated
vendored
@@ -7,6 +7,7 @@ package astutil
|
||||
import "go/ast"
|
||||
|
||||
// Unparen returns e with any enclosing parentheses stripped.
|
||||
// TODO(adonovan): use go1.22's ast.Unparen.
|
||||
func Unparen(e ast.Expr) ast.Expr {
|
||||
for {
|
||||
p, ok := e.(*ast.ParenExpr)
|
||||
|
||||
53
vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go
generated
vendored
53
vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go
generated
vendored
@@ -1,53 +0,0 @@
|
||||
// Copyright 2018 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.
|
||||
|
||||
// Package packagesdriver fetches type sizes for go/packages and go/analysis.
|
||||
package packagesdriver
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/tools/internal/gocommand"
|
||||
)
|
||||
|
||||
func GetSizesForArgsGolist(ctx context.Context, inv gocommand.Invocation, gocmdRunner *gocommand.Runner) (string, string, error) {
|
||||
inv.Verb = "list"
|
||||
inv.Args = []string{"-f", "{{context.GOARCH}} {{context.Compiler}}", "--", "unsafe"}
|
||||
stdout, stderr, friendlyErr, rawErr := gocmdRunner.RunRaw(ctx, inv)
|
||||
var goarch, compiler string
|
||||
if rawErr != nil {
|
||||
rawErrMsg := rawErr.Error()
|
||||
if strings.Contains(rawErrMsg, "cannot find main module") ||
|
||||
strings.Contains(rawErrMsg, "go.mod file not found") {
|
||||
// User's running outside of a module.
|
||||
// All bets are off. Get GOARCH and guess compiler is gc.
|
||||
// TODO(matloob): Is this a problem in practice?
|
||||
inv.Verb = "env"
|
||||
inv.Args = []string{"GOARCH"}
|
||||
envout, enverr := gocmdRunner.Run(ctx, inv)
|
||||
if enverr != nil {
|
||||
return "", "", enverr
|
||||
}
|
||||
goarch = strings.TrimSpace(envout.String())
|
||||
compiler = "gc"
|
||||
} else if friendlyErr != nil {
|
||||
return "", "", friendlyErr
|
||||
} else {
|
||||
// This should be unreachable, but be defensive
|
||||
// in case RunRaw's error results are inconsistent.
|
||||
return "", "", rawErr
|
||||
}
|
||||
} else {
|
||||
fields := strings.Fields(stdout.String())
|
||||
if len(fields) < 2 {
|
||||
return "", "", fmt.Errorf("could not parse GOARCH and Go compiler in format \"<GOARCH> <compiler>\":\nstdout: <<%s>>\nstderr: <<%s>>",
|
||||
stdout.String(), stderr.String())
|
||||
}
|
||||
goarch = fields[0]
|
||||
compiler = fields[1]
|
||||
}
|
||||
return compiler, goarch, nil
|
||||
}
|
||||
8
vendor/golang.org/x/tools/go/packages/doc.go
generated
vendored
8
vendor/golang.org/x/tools/go/packages/doc.go
generated
vendored
@@ -198,14 +198,6 @@ Instead, ssadump no longer requests the runtime package,
|
||||
but seeks it among the dependencies of the user-specified packages,
|
||||
and emits an error if it is not found.
|
||||
|
||||
Overlays: The Overlay field in the Config allows providing alternate contents
|
||||
for Go source files, by providing a mapping from file path to contents.
|
||||
go/packages will pull in new imports added in overlay files when go/packages
|
||||
is run in LoadImports mode or greater.
|
||||
Overlay support for the go list driver isn't complete yet: if the file doesn't
|
||||
exist on disk, it will only be recognized in an overlay if it is a non-test file
|
||||
and the package would be reported even without the overlay.
|
||||
|
||||
Questions & Tasks
|
||||
|
||||
- Add GOARCH/GOOS?
|
||||
|
||||
22
vendor/golang.org/x/tools/go/packages/external.go
generated
vendored
22
vendor/golang.org/x/tools/go/packages/external.go
generated
vendored
@@ -34,8 +34,8 @@ type DriverRequest struct {
|
||||
// Tests specifies whether the patterns should also return test packages.
|
||||
Tests bool `json:"tests"`
|
||||
|
||||
// Overlay maps file paths (relative to the driver's working directory) to the byte contents
|
||||
// of overlay files.
|
||||
// Overlay maps file paths (relative to the driver's working directory)
|
||||
// to the contents of overlay files (see Config.Overlay).
|
||||
Overlay map[string][]byte `json:"overlay"`
|
||||
}
|
||||
|
||||
@@ -119,7 +119,19 @@ func findExternalDriver(cfg *Config) driver {
|
||||
stderr := new(bytes.Buffer)
|
||||
cmd := exec.CommandContext(cfg.Context, tool, words...)
|
||||
cmd.Dir = cfg.Dir
|
||||
cmd.Env = cfg.Env
|
||||
// The cwd gets resolved to the real path. On Darwin, where
|
||||
// /tmp is a symlink, this breaks anything that expects the
|
||||
// working directory to keep the original path, including the
|
||||
// go command when dealing with modules.
|
||||
//
|
||||
// os.Getwd stdlib has a special feature where if the
|
||||
// cwd and the PWD are the same node then it trusts
|
||||
// the PWD, so by setting it in the env for the child
|
||||
// process we fix up all the paths returned by the go
|
||||
// command.
|
||||
//
|
||||
// (See similar trick in Invocation.run in ../../internal/gocommand/invoke.go)
|
||||
cmd.Env = append(slicesClip(cfg.Env), "PWD="+cfg.Dir)
|
||||
cmd.Stdin = bytes.NewReader(req)
|
||||
cmd.Stdout = buf
|
||||
cmd.Stderr = stderr
|
||||
@@ -138,3 +150,7 @@ 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)] }
|
||||
|
||||
126
vendor/golang.org/x/tools/go/packages/golist.go
generated
vendored
126
vendor/golang.org/x/tools/go/packages/golist.go
generated
vendored
@@ -21,7 +21,6 @@ import (
|
||||
"sync"
|
||||
"unicode"
|
||||
|
||||
"golang.org/x/tools/go/internal/packagesdriver"
|
||||
"golang.org/x/tools/internal/gocommand"
|
||||
"golang.org/x/tools/internal/packagesinternal"
|
||||
)
|
||||
@@ -149,7 +148,7 @@ func goListDriver(cfg *Config, patterns ...string) (_ *DriverResponse, err error
|
||||
if cfg.Mode&NeedTypesSizes != 0 || cfg.Mode&NeedTypes != 0 {
|
||||
errCh := make(chan error)
|
||||
go func() {
|
||||
compiler, arch, err := packagesdriver.GetSizesForArgsGolist(ctx, state.cfgInvocation(), cfg.gocmdRunner)
|
||||
compiler, arch, err := getSizesForArgs(ctx, state.cfgInvocation(), cfg.gocmdRunner)
|
||||
response.dr.Compiler = compiler
|
||||
response.dr.Arch = arch
|
||||
errCh <- err
|
||||
@@ -841,6 +840,7 @@ func (state *golistState) cfgInvocation() gocommand.Invocation {
|
||||
Env: cfg.Env,
|
||||
Logf: cfg.Logf,
|
||||
WorkingDir: cfg.Dir,
|
||||
Overlay: cfg.goListOverlayFile,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -849,26 +849,6 @@ func (state *golistState) invokeGo(verb string, args ...string) (*bytes.Buffer,
|
||||
cfg := state.cfg
|
||||
|
||||
inv := state.cfgInvocation()
|
||||
|
||||
// For Go versions 1.16 and above, `go list` accepts overlays directly via
|
||||
// the -overlay flag. Set it, if it's available.
|
||||
//
|
||||
// The check for "list" is not necessarily required, but we should avoid
|
||||
// getting the go version if possible.
|
||||
if verb == "list" {
|
||||
goVersion, err := state.getGoVersion()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if goVersion >= 16 {
|
||||
filename, cleanup, err := state.writeOverlays()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer cleanup()
|
||||
inv.Overlay = filename
|
||||
}
|
||||
}
|
||||
inv.Verb = verb
|
||||
inv.Args = args
|
||||
gocmdRunner := cfg.gocmdRunner
|
||||
@@ -1015,67 +995,6 @@ func (state *golistState) invokeGo(verb string, args ...string) (*bytes.Buffer,
|
||||
return stdout, nil
|
||||
}
|
||||
|
||||
// OverlayJSON is the format overlay files are expected to be in.
|
||||
// The Replace map maps from overlaid paths to replacement paths:
|
||||
// the Go command will forward all reads trying to open
|
||||
// each overlaid path to its replacement path, or consider the overlaid
|
||||
// path not to exist if the replacement path is empty.
|
||||
//
|
||||
// From golang/go#39958.
|
||||
type OverlayJSON struct {
|
||||
Replace map[string]string `json:"replace,omitempty"`
|
||||
}
|
||||
|
||||
// writeOverlays writes out files for go list's -overlay flag, as described
|
||||
// above.
|
||||
func (state *golistState) writeOverlays() (filename string, cleanup func(), err error) {
|
||||
// Do nothing if there are no overlays in the config.
|
||||
if len(state.cfg.Overlay) == 0 {
|
||||
return "", func() {}, nil
|
||||
}
|
||||
dir, err := os.MkdirTemp("", "gopackages-*")
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
// The caller must clean up this directory, unless this function returns an
|
||||
// error.
|
||||
cleanup = func() {
|
||||
os.RemoveAll(dir)
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
cleanup()
|
||||
}
|
||||
}()
|
||||
overlays := map[string]string{}
|
||||
for k, v := range state.cfg.Overlay {
|
||||
// Create a unique filename for the overlaid files, to avoid
|
||||
// creating nested directories.
|
||||
noSeparator := strings.Join(strings.Split(filepath.ToSlash(k), "/"), "")
|
||||
f, err := os.CreateTemp(dir, fmt.Sprintf("*-%s", noSeparator))
|
||||
if err != nil {
|
||||
return "", func() {}, err
|
||||
}
|
||||
if _, err := f.Write(v); err != nil {
|
||||
return "", func() {}, err
|
||||
}
|
||||
if err := f.Close(); err != nil {
|
||||
return "", func() {}, err
|
||||
}
|
||||
overlays[k] = f.Name()
|
||||
}
|
||||
b, err := json.Marshal(OverlayJSON{Replace: overlays})
|
||||
if err != nil {
|
||||
return "", func() {}, err
|
||||
}
|
||||
// Write out the overlay file that contains the filepath mappings.
|
||||
filename = filepath.Join(dir, "overlay.json")
|
||||
if err := os.WriteFile(filename, b, 0665); err != nil {
|
||||
return "", func() {}, err
|
||||
}
|
||||
return filename, cleanup, nil
|
||||
}
|
||||
|
||||
func containsGoFile(s []string) bool {
|
||||
for _, f := range s {
|
||||
if strings.HasSuffix(f, ".go") {
|
||||
@@ -1104,3 +1023,44 @@ func cmdDebugStr(cmd *exec.Cmd) string {
|
||||
}
|
||||
return fmt.Sprintf("GOROOT=%v GOPATH=%v GO111MODULE=%v GOPROXY=%v PWD=%v %v", env["GOROOT"], env["GOPATH"], env["GO111MODULE"], env["GOPROXY"], env["PWD"], strings.Join(args, " "))
|
||||
}
|
||||
|
||||
// getSizesForArgs queries 'go list' for the appropriate
|
||||
// Compiler and GOARCH arguments to pass to [types.SizesFor].
|
||||
func getSizesForArgs(ctx context.Context, inv gocommand.Invocation, gocmdRunner *gocommand.Runner) (string, string, error) {
|
||||
inv.Verb = "list"
|
||||
inv.Args = []string{"-f", "{{context.GOARCH}} {{context.Compiler}}", "--", "unsafe"}
|
||||
stdout, stderr, friendlyErr, rawErr := gocmdRunner.RunRaw(ctx, inv)
|
||||
var goarch, compiler string
|
||||
if rawErr != nil {
|
||||
rawErrMsg := rawErr.Error()
|
||||
if strings.Contains(rawErrMsg, "cannot find main module") ||
|
||||
strings.Contains(rawErrMsg, "go.mod file not found") {
|
||||
// User's running outside of a module.
|
||||
// All bets are off. Get GOARCH and guess compiler is gc.
|
||||
// TODO(matloob): Is this a problem in practice?
|
||||
inv.Verb = "env"
|
||||
inv.Args = []string{"GOARCH"}
|
||||
envout, enverr := gocmdRunner.Run(ctx, inv)
|
||||
if enverr != nil {
|
||||
return "", "", enverr
|
||||
}
|
||||
goarch = strings.TrimSpace(envout.String())
|
||||
compiler = "gc"
|
||||
} else if friendlyErr != nil {
|
||||
return "", "", friendlyErr
|
||||
} else {
|
||||
// This should be unreachable, but be defensive
|
||||
// in case RunRaw's error results are inconsistent.
|
||||
return "", "", rawErr
|
||||
}
|
||||
} else {
|
||||
fields := strings.Fields(stdout.String())
|
||||
if len(fields) < 2 {
|
||||
return "", "", fmt.Errorf("could not parse GOARCH and Go compiler in format \"<GOARCH> <compiler>\":\nstdout: <<%s>>\nstderr: <<%s>>",
|
||||
stdout.String(), stderr.String())
|
||||
}
|
||||
goarch = fields[0]
|
||||
compiler = fields[1]
|
||||
}
|
||||
return compiler, goarch, nil
|
||||
}
|
||||
|
||||
95
vendor/golang.org/x/tools/go/packages/packages.go
generated
vendored
95
vendor/golang.org/x/tools/go/packages/packages.go
generated
vendored
@@ -37,10 +37,20 @@ import (
|
||||
// A LoadMode controls the amount of detail to return when loading.
|
||||
// The bits below can be combined to specify which fields should be
|
||||
// filled in the result packages.
|
||||
//
|
||||
// The zero value is a special case, equivalent to combining
|
||||
// the NeedName, NeedFiles, and NeedCompiledGoFiles bits.
|
||||
//
|
||||
// ID and Errors (if present) will always be filled.
|
||||
// Load may return more information than requested.
|
||||
// [Load] may return more information than requested.
|
||||
//
|
||||
// Unfortunately there are a number of open bugs related to
|
||||
// interactions among the LoadMode bits:
|
||||
// - https://github.com/golang/go/issues/48226
|
||||
// - https://github.com/golang/go/issues/56633
|
||||
// - https://github.com/golang/go/issues/56677
|
||||
// - https://github.com/golang/go/issues/58726
|
||||
// - https://github.com/golang/go/issues/63517
|
||||
type LoadMode int
|
||||
|
||||
const (
|
||||
@@ -123,7 +133,14 @@ const (
|
||||
|
||||
// A Config specifies details about how packages should be loaded.
|
||||
// The zero value is a valid configuration.
|
||||
//
|
||||
// Calls to Load do not modify this struct.
|
||||
//
|
||||
// TODO(adonovan): #67702: this is currently false: in fact,
|
||||
// calls to [Load] do not modify the public fields of this struct, but
|
||||
// may modify hidden fields, so concurrent calls to [Load] must not
|
||||
// use the same Config. But perhaps we should reestablish the
|
||||
// documented invariant.
|
||||
type Config struct {
|
||||
// Mode controls the level of information returned for each package.
|
||||
Mode LoadMode
|
||||
@@ -199,13 +216,23 @@ type Config struct {
|
||||
// setting Tests may have no effect.
|
||||
Tests bool
|
||||
|
||||
// Overlay provides a mapping of absolute file paths to file contents.
|
||||
// If the file with the given path already exists, the parser will use the
|
||||
// alternative file contents provided by the map.
|
||||
// Overlay is a mapping from absolute file paths to file contents.
|
||||
//
|
||||
// Overlays provide incomplete support for when a given file doesn't
|
||||
// already exist on disk. See the package doc above for more details.
|
||||
// For each map entry, [Load] uses the alternative file
|
||||
// contents provided by the overlay mapping instead of reading
|
||||
// from the file system. This mechanism can be used to enable
|
||||
// editor-integrated tools to correctly analyze the contents
|
||||
// of modified but unsaved buffers, for example.
|
||||
//
|
||||
// The overlay mapping is passed to the build system's driver
|
||||
// (see "The driver protocol") so that it too can report
|
||||
// consistent package metadata about unsaved files. However,
|
||||
// drivers may vary in their level of support for overlays.
|
||||
Overlay map[string][]byte
|
||||
|
||||
// goListOverlayFile is the JSON file that encodes the Overlay
|
||||
// mapping, used by 'go list -overlay=...'
|
||||
goListOverlayFile string
|
||||
}
|
||||
|
||||
// Load loads and returns the Go packages named by the given patterns.
|
||||
@@ -213,6 +240,20 @@ type Config struct {
|
||||
// Config specifies loading options;
|
||||
// nil behaves the same as an empty Config.
|
||||
//
|
||||
// The [Config.Mode] field is a set of bits that determine what kinds
|
||||
// of information should be computed and returned. Modes that require
|
||||
// more information tend to be slower. See [LoadMode] for details
|
||||
// and important caveats. Its zero value is equivalent to
|
||||
// NeedName | NeedFiles | NeedCompiledGoFiles.
|
||||
//
|
||||
// Each call to Load returns a new set of [Package] instances.
|
||||
// The Packages and their Imports form a directed acyclic graph.
|
||||
//
|
||||
// If the [NeedTypes] mode flag was set, each call to Load uses a new
|
||||
// [types.Importer], so [types.Object] and [types.Type] values from
|
||||
// different calls to Load must not be mixed as they will have
|
||||
// inconsistent notions of type identity.
|
||||
//
|
||||
// If any of the patterns was invalid as defined by the
|
||||
// underlying build system, Load returns an error.
|
||||
// It may return an empty list of packages without an error,
|
||||
@@ -286,6 +327,17 @@ func defaultDriver(cfg *Config, patterns ...string) (*DriverResponse, bool, erro
|
||||
// (fall through)
|
||||
}
|
||||
|
||||
// go list fallback
|
||||
//
|
||||
// Write overlays once, as there are many calls
|
||||
// to 'go list' (one per chunk plus others too).
|
||||
overlay, cleanupOverlay, err := gocommand.WriteOverlays(cfg.Overlay)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
defer cleanupOverlay()
|
||||
cfg.goListOverlayFile = overlay
|
||||
|
||||
response, err := callDriverOnChunks(goListDriver, cfg, chunks)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
@@ -365,6 +417,9 @@ func mergeResponses(responses ...*DriverResponse) *DriverResponse {
|
||||
}
|
||||
|
||||
// A Package describes a loaded Go package.
|
||||
//
|
||||
// It also defines part of the JSON schema of [DriverResponse].
|
||||
// See the package documentation for an overview.
|
||||
type Package struct {
|
||||
// ID is a unique identifier for a package,
|
||||
// in a syntax provided by the underlying build system.
|
||||
@@ -423,6 +478,13 @@ type Package struct {
|
||||
// to corresponding loaded Packages.
|
||||
Imports map[string]*Package
|
||||
|
||||
// Module is the module information for the package if it exists.
|
||||
//
|
||||
// Note: it may be missing for std and cmd; see Go issue #65816.
|
||||
Module *Module
|
||||
|
||||
// -- The following fields are not part of the driver JSON schema. --
|
||||
|
||||
// Types provides type information for the package.
|
||||
// The NeedTypes LoadMode bit sets this field for packages matching the
|
||||
// patterns; type information for dependencies may be missing or incomplete,
|
||||
@@ -431,15 +493,15 @@ type Package struct {
|
||||
// Each call to [Load] returns a consistent set of type
|
||||
// symbols, as defined by the comment at [types.Identical].
|
||||
// Avoid mixing type information from two or more calls to [Load].
|
||||
Types *types.Package
|
||||
Types *types.Package `json:"-"`
|
||||
|
||||
// Fset provides position information for Types, TypesInfo, and Syntax.
|
||||
// It is set only when Types is set.
|
||||
Fset *token.FileSet
|
||||
Fset *token.FileSet `json:"-"`
|
||||
|
||||
// IllTyped indicates whether the package or any dependency contains errors.
|
||||
// It is set only when Types is set.
|
||||
IllTyped bool
|
||||
IllTyped bool `json:"-"`
|
||||
|
||||
// Syntax is the package's syntax trees, for the files listed in CompiledGoFiles.
|
||||
//
|
||||
@@ -449,26 +511,28 @@ type Package struct {
|
||||
//
|
||||
// Syntax is kept in the same order as CompiledGoFiles, with the caveat that nils are
|
||||
// removed. If parsing returned nil, Syntax may be shorter than CompiledGoFiles.
|
||||
Syntax []*ast.File
|
||||
Syntax []*ast.File `json:"-"`
|
||||
|
||||
// TypesInfo provides type information about the package's syntax trees.
|
||||
// It is set only when Syntax is set.
|
||||
TypesInfo *types.Info
|
||||
TypesInfo *types.Info `json:"-"`
|
||||
|
||||
// TypesSizes provides the effective size function for types in TypesInfo.
|
||||
TypesSizes types.Sizes
|
||||
TypesSizes types.Sizes `json:"-"`
|
||||
|
||||
// -- internal --
|
||||
|
||||
// forTest is the package under test, if any.
|
||||
forTest string
|
||||
|
||||
// depsErrors is the DepsErrors field from the go list response, if any.
|
||||
depsErrors []*packagesinternal.PackageError
|
||||
|
||||
// module is the module information for the package if it exists.
|
||||
Module *Module
|
||||
}
|
||||
|
||||
// Module provides module information for a package.
|
||||
//
|
||||
// It also defines part of the JSON schema of [DriverResponse].
|
||||
// See the package documentation for an overview.
|
||||
type Module struct {
|
||||
Path string // module path
|
||||
Version string // module version
|
||||
@@ -601,6 +665,7 @@ func (p *Package) UnmarshalJSON(b []byte) error {
|
||||
OtherFiles: flat.OtherFiles,
|
||||
EmbedFiles: flat.EmbedFiles,
|
||||
EmbedPatterns: flat.EmbedPatterns,
|
||||
IgnoredFiles: flat.IgnoredFiles,
|
||||
ExportFile: flat.ExportFile,
|
||||
}
|
||||
if len(flat.Imports) > 0 {
|
||||
|
||||
59
vendor/golang.org/x/tools/go/types/objectpath/objectpath.go
generated
vendored
59
vendor/golang.org/x/tools/go/types/objectpath/objectpath.go
generated
vendored
@@ -51,7 +51,7 @@ type Path string
|
||||
//
|
||||
// PO package->object Package.Scope.Lookup
|
||||
// OT object->type Object.Type
|
||||
// TT type->type Type.{Elem,Key,Params,Results,Underlying} [EKPRU]
|
||||
// TT type->type Type.{Elem,Key,{,{,Recv}Type}Params,Results,Underlying} [EKPRUTrC]
|
||||
// TO type->object Type.{At,Field,Method,Obj} [AFMO]
|
||||
//
|
||||
// All valid paths start with a package and end at an object
|
||||
@@ -63,8 +63,8 @@ type Path string
|
||||
// - The only PO operator is Package.Scope.Lookup, which requires an identifier.
|
||||
// - The only OT operator is Object.Type,
|
||||
// which we encode as '.' because dot cannot appear in an identifier.
|
||||
// - The TT operators are encoded as [EKPRUTC];
|
||||
// one of these (TypeParam) requires an integer operand,
|
||||
// - The TT operators are encoded as [EKPRUTrC];
|
||||
// two of these ({,Recv}TypeParams) require an integer operand,
|
||||
// which is encoded as a string of decimal digits.
|
||||
// - The TO operators are encoded as [AFMO];
|
||||
// three of these (At,Field,Method) require an integer operand,
|
||||
@@ -98,19 +98,20 @@ const (
|
||||
opType = '.' // .Type() (Object)
|
||||
|
||||
// type->type operators
|
||||
opElem = 'E' // .Elem() (Pointer, Slice, Array, Chan, Map)
|
||||
opKey = 'K' // .Key() (Map)
|
||||
opParams = 'P' // .Params() (Signature)
|
||||
opResults = 'R' // .Results() (Signature)
|
||||
opUnderlying = 'U' // .Underlying() (Named)
|
||||
opTypeParam = 'T' // .TypeParams.At(i) (Named, Signature)
|
||||
opConstraint = 'C' // .Constraint() (TypeParam)
|
||||
opElem = 'E' // .Elem() (Pointer, Slice, Array, Chan, Map)
|
||||
opKey = 'K' // .Key() (Map)
|
||||
opParams = 'P' // .Params() (Signature)
|
||||
opResults = 'R' // .Results() (Signature)
|
||||
opUnderlying = 'U' // .Underlying() (Named)
|
||||
opTypeParam = 'T' // .TypeParams.At(i) (Named, Signature)
|
||||
opRecvTypeParam = 'r' // .RecvTypeParams.At(i) (Signature)
|
||||
opConstraint = 'C' // .Constraint() (TypeParam)
|
||||
|
||||
// type->object operators
|
||||
opAt = 'A' // .At(i) (Tuple)
|
||||
opField = 'F' // .Field(i) (Struct)
|
||||
opMethod = 'M' // .Method(i) (Named or Interface; not Struct: "promoted" names are ignored)
|
||||
opObj = 'O' // .Obj() (Named, TypeParam)
|
||||
opAt = 'A' // .At(i) (Tuple)
|
||||
opField = 'F' // .Field(i) (Struct)
|
||||
opMethod = 'M' // .Method(i) (Named or Interface; not Struct: "promoted" names are ignored)
|
||||
opObj = 'O' // .Obj() (Named, TypeParam)
|
||||
)
|
||||
|
||||
// For is equivalent to new(Encoder).For(obj).
|
||||
@@ -286,7 +287,7 @@ func (enc *Encoder) For(obj types.Object) (Path, error) {
|
||||
}
|
||||
} else {
|
||||
if named, _ := T.(*types.Named); named != nil {
|
||||
if r := findTypeParam(obj, named.TypeParams(), path, nil); r != nil {
|
||||
if r := findTypeParam(obj, named.TypeParams(), path, opTypeParam, nil); r != nil {
|
||||
// generic named type
|
||||
return Path(r), nil
|
||||
}
|
||||
@@ -462,7 +463,10 @@ func find(obj types.Object, T types.Type, path []byte, seen map[*types.TypeName]
|
||||
}
|
||||
return find(obj, T.Elem(), append(path, opElem), seen)
|
||||
case *types.Signature:
|
||||
if r := findTypeParam(obj, T.TypeParams(), path, seen); r != nil {
|
||||
if r := findTypeParam(obj, T.RecvTypeParams(), path, opRecvTypeParam, nil); r != nil {
|
||||
return r
|
||||
}
|
||||
if r := findTypeParam(obj, T.TypeParams(), path, opTypeParam, seen); r != nil {
|
||||
return r
|
||||
}
|
||||
if r := find(obj, T.Params(), append(path, opParams), seen); r != nil {
|
||||
@@ -525,10 +529,10 @@ func find(obj types.Object, T types.Type, path []byte, seen map[*types.TypeName]
|
||||
panic(T)
|
||||
}
|
||||
|
||||
func findTypeParam(obj types.Object, list *types.TypeParamList, path []byte, seen map[*types.TypeName]bool) []byte {
|
||||
func findTypeParam(obj types.Object, list *types.TypeParamList, path []byte, op byte, seen map[*types.TypeName]bool) []byte {
|
||||
for i := 0; i < list.Len(); i++ {
|
||||
tparam := list.At(i)
|
||||
path2 := appendOpArg(path, opTypeParam, i)
|
||||
path2 := appendOpArg(path, op, i)
|
||||
if r := find(obj, tparam, path2, seen); r != nil {
|
||||
return r
|
||||
}
|
||||
@@ -580,10 +584,10 @@ func Object(pkg *types.Package, p Path) (types.Object, error) {
|
||||
code := suffix[0]
|
||||
suffix = suffix[1:]
|
||||
|
||||
// Codes [AFM] have an integer operand.
|
||||
// Codes [AFMTr] have an integer operand.
|
||||
var index int
|
||||
switch code {
|
||||
case opAt, opField, opMethod, opTypeParam:
|
||||
case opAt, opField, opMethod, opTypeParam, opRecvTypeParam:
|
||||
rest := strings.TrimLeft(suffix, "0123456789")
|
||||
numerals := suffix[:len(suffix)-len(rest)]
|
||||
suffix = rest
|
||||
@@ -664,6 +668,17 @@ func Object(pkg *types.Package, p Path) (types.Object, error) {
|
||||
}
|
||||
t = tparams.At(index)
|
||||
|
||||
case opRecvTypeParam:
|
||||
sig, ok := t.(*types.Signature) // Signature
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("cannot apply %q to %s (got %T, want signature)", code, t, t)
|
||||
}
|
||||
rtparams := sig.RecvTypeParams()
|
||||
if n := rtparams.Len(); index >= n {
|
||||
return nil, fmt.Errorf("tuple index %d out of range [0-%d)", index, n)
|
||||
}
|
||||
t = rtparams.At(index)
|
||||
|
||||
case opConstraint:
|
||||
tparam, ok := t.(*types.TypeParam)
|
||||
if !ok {
|
||||
@@ -725,6 +740,10 @@ func Object(pkg *types.Package, p Path) (types.Object, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if obj == nil {
|
||||
panic(p) // path does not end in an object-valued operator
|
||||
}
|
||||
|
||||
if obj.Pkg() != pkg {
|
||||
return nil, fmt.Errorf("path denotes %s, which belongs to a different package", obj)
|
||||
}
|
||||
|
||||
113
vendor/golang.org/x/tools/internal/gocommand/invoke.go
generated
vendored
113
vendor/golang.org/x/tools/internal/gocommand/invoke.go
generated
vendored
@@ -8,12 +8,14 @@ package gocommand
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"runtime"
|
||||
@@ -167,7 +169,9 @@ type Invocation struct {
|
||||
// TODO(rfindley): remove, in favor of Args.
|
||||
ModFile string
|
||||
|
||||
// If Overlay is set, the go command is invoked with -overlay=Overlay.
|
||||
// Overlay is the name of the JSON overlay file that describes
|
||||
// unsaved editor buffers; see [WriteOverlays].
|
||||
// If set, the go command is invoked with -overlay=Overlay.
|
||||
// TODO(rfindley): remove, in favor of Args.
|
||||
Overlay string
|
||||
|
||||
@@ -196,12 +200,14 @@ func (i *Invocation) runWithFriendlyError(ctx context.Context, stdout, stderr io
|
||||
return
|
||||
}
|
||||
|
||||
func (i *Invocation) run(ctx context.Context, stdout, stderr io.Writer) error {
|
||||
log := i.Logf
|
||||
if log == nil {
|
||||
log = func(string, ...interface{}) {}
|
||||
// logf logs if i.Logf is non-nil.
|
||||
func (i *Invocation) logf(format string, args ...any) {
|
||||
if i.Logf != nil {
|
||||
i.Logf(format, args...)
|
||||
}
|
||||
}
|
||||
|
||||
func (i *Invocation) run(ctx context.Context, stdout, stderr io.Writer) error {
|
||||
goArgs := []string{i.Verb}
|
||||
|
||||
appendModFile := func() {
|
||||
@@ -255,12 +261,15 @@ func (i *Invocation) run(ctx context.Context, stdout, stderr io.Writer) error {
|
||||
waitDelay.Set(reflect.ValueOf(30 * time.Second))
|
||||
}
|
||||
|
||||
// On darwin the cwd gets resolved to the real path, which breaks anything that
|
||||
// expects the working directory to keep the original path, including the
|
||||
// The cwd gets resolved to the real path. On Darwin, where
|
||||
// /tmp is a symlink, this breaks anything that expects the
|
||||
// working directory to keep the original path, including the
|
||||
// go command when dealing with modules.
|
||||
// The Go stdlib has a special feature where if the cwd and the PWD are the
|
||||
// same node then it trusts the PWD, so by setting it in the env for the child
|
||||
// process we fix up all the paths returned by the go command.
|
||||
//
|
||||
// os.Getwd has a special feature where if the cwd and the PWD
|
||||
// are the same node then it trusts the PWD, so by setting it
|
||||
// in the env for the child process we fix up all the paths
|
||||
// returned by the go command.
|
||||
if !i.CleanEnv {
|
||||
cmd.Env = os.Environ()
|
||||
}
|
||||
@@ -270,7 +279,12 @@ func (i *Invocation) run(ctx context.Context, stdout, stderr io.Writer) error {
|
||||
cmd.Dir = i.WorkingDir
|
||||
}
|
||||
|
||||
defer func(start time.Time) { log("%s for %v", time.Since(start), cmdDebugStr(cmd)) }(time.Now())
|
||||
debugStr := cmdDebugStr(cmd)
|
||||
i.logf("starting %v", debugStr)
|
||||
start := time.Now()
|
||||
defer func() {
|
||||
i.logf("%s for %v", time.Since(start), debugStr)
|
||||
}()
|
||||
|
||||
return runCmdContext(ctx, cmd)
|
||||
}
|
||||
@@ -351,6 +365,7 @@ func runCmdContext(ctx context.Context, cmd *exec.Cmd) (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
startTime := time.Now()
|
||||
err = cmd.Start()
|
||||
if stdoutW != nil {
|
||||
// The child process has inherited the pipe file,
|
||||
@@ -377,7 +392,7 @@ func runCmdContext(ctx context.Context, cmd *exec.Cmd) (err error) {
|
||||
case err := <-resChan:
|
||||
return err
|
||||
case <-timer.C:
|
||||
HandleHangingGoCommand(cmd.Process)
|
||||
HandleHangingGoCommand(startTime, cmd)
|
||||
case <-ctx.Done():
|
||||
}
|
||||
} else {
|
||||
@@ -411,7 +426,7 @@ func runCmdContext(ctx context.Context, cmd *exec.Cmd) (err error) {
|
||||
return <-resChan
|
||||
}
|
||||
|
||||
func HandleHangingGoCommand(proc *os.Process) {
|
||||
func HandleHangingGoCommand(start time.Time, cmd *exec.Cmd) {
|
||||
switch runtime.GOOS {
|
||||
case "linux", "darwin", "freebsd", "netbsd":
|
||||
fmt.Fprintln(os.Stderr, `DETECTED A HANGING GO COMMAND
|
||||
@@ -444,7 +459,7 @@ See golang/go#54461 for more details.`)
|
||||
panic(fmt.Sprintf("running %s: %v", listFiles, err))
|
||||
}
|
||||
}
|
||||
panic(fmt.Sprintf("detected hanging go command (pid %d): see golang/go#54461 for more details", proc.Pid))
|
||||
panic(fmt.Sprintf("detected hanging go command (golang/go#54461); waited %s\n\tcommand:%s\n\tpid:%d", time.Since(start), cmd, cmd.Process.Pid))
|
||||
}
|
||||
|
||||
func cmdDebugStr(cmd *exec.Cmd) string {
|
||||
@@ -468,3 +483,73 @@ func cmdDebugStr(cmd *exec.Cmd) string {
|
||||
}
|
||||
return fmt.Sprintf("GOROOT=%v GOPATH=%v GO111MODULE=%v GOPROXY=%v PWD=%v %v", env["GOROOT"], env["GOPATH"], env["GO111MODULE"], env["GOPROXY"], env["PWD"], strings.Join(args, " "))
|
||||
}
|
||||
|
||||
// WriteOverlays writes each value in the overlay (see the Overlay
|
||||
// field of go/packages.Config) to a temporary file and returns the name
|
||||
// of a JSON file describing the mapping that is suitable for the "go
|
||||
// list -overlay" flag.
|
||||
//
|
||||
// On success, the caller must call the cleanup function exactly once
|
||||
// when the files are no longer needed.
|
||||
func WriteOverlays(overlay map[string][]byte) (filename string, cleanup func(), err error) {
|
||||
// Do nothing if there are no overlays in the config.
|
||||
if len(overlay) == 0 {
|
||||
return "", func() {}, nil
|
||||
}
|
||||
|
||||
dir, err := os.MkdirTemp("", "gocommand-*")
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
|
||||
// The caller must clean up this directory,
|
||||
// unless this function returns an error.
|
||||
// (The cleanup operand of each return
|
||||
// statement below is ignored.)
|
||||
defer func() {
|
||||
cleanup = func() {
|
||||
os.RemoveAll(dir)
|
||||
}
|
||||
if err != nil {
|
||||
cleanup()
|
||||
cleanup = nil
|
||||
}
|
||||
}()
|
||||
|
||||
// Write each map entry to a temporary file.
|
||||
overlays := make(map[string]string)
|
||||
for k, v := range overlay {
|
||||
// Use a unique basename for each file (001-foo.go),
|
||||
// to avoid creating nested directories.
|
||||
base := fmt.Sprintf("%d-%s", 1+len(overlays), filepath.Base(k))
|
||||
filename := filepath.Join(dir, base)
|
||||
err := os.WriteFile(filename, v, 0666)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
overlays[k] = filename
|
||||
}
|
||||
|
||||
// Write the JSON overlay file that maps logical file names to temp files.
|
||||
//
|
||||
// OverlayJSON is the format overlay files are expected to be in.
|
||||
// The Replace map maps from overlaid paths to replacement paths:
|
||||
// the Go command will forward all reads trying to open
|
||||
// each overlaid path to its replacement path, or consider the overlaid
|
||||
// path not to exist if the replacement path is empty.
|
||||
//
|
||||
// From golang/go#39958.
|
||||
type OverlayJSON struct {
|
||||
Replace map[string]string `json:"replace,omitempty"`
|
||||
}
|
||||
b, err := json.Marshal(OverlayJSON{Replace: overlays})
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
filename = filepath.Join(dir, "overlay.json")
|
||||
if err := os.WriteFile(filename, b, 0666); err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
|
||||
return filename, nil, nil
|
||||
}
|
||||
|
||||
357
vendor/golang.org/x/tools/internal/imports/fix.go
generated
vendored
357
vendor/golang.org/x/tools/internal/imports/fix.go
generated
vendored
@@ -27,6 +27,7 @@ import (
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
|
||||
"golang.org/x/sync/errgroup"
|
||||
"golang.org/x/tools/go/ast/astutil"
|
||||
"golang.org/x/tools/internal/event"
|
||||
"golang.org/x/tools/internal/gocommand"
|
||||
@@ -104,7 +105,10 @@ type packageInfo struct {
|
||||
|
||||
// parseOtherFiles parses all the Go files in srcDir except filename, including
|
||||
// test files if filename looks like a test.
|
||||
func parseOtherFiles(fset *token.FileSet, srcDir, filename string) []*ast.File {
|
||||
//
|
||||
// It returns an error only if ctx is cancelled. Files with parse errors are
|
||||
// ignored.
|
||||
func parseOtherFiles(ctx context.Context, fset *token.FileSet, srcDir, filename string) ([]*ast.File, error) {
|
||||
// This could use go/packages but it doesn't buy much, and it fails
|
||||
// with https://golang.org/issue/26296 in LoadFiles mode in some cases.
|
||||
considerTests := strings.HasSuffix(filename, "_test.go")
|
||||
@@ -112,11 +116,14 @@ func parseOtherFiles(fset *token.FileSet, srcDir, filename string) []*ast.File {
|
||||
fileBase := filepath.Base(filename)
|
||||
packageFileInfos, err := os.ReadDir(srcDir)
|
||||
if err != nil {
|
||||
return nil
|
||||
return nil, ctx.Err()
|
||||
}
|
||||
|
||||
var files []*ast.File
|
||||
for _, fi := range packageFileInfos {
|
||||
if ctx.Err() != nil {
|
||||
return nil, ctx.Err()
|
||||
}
|
||||
if fi.Name() == fileBase || !strings.HasSuffix(fi.Name(), ".go") {
|
||||
continue
|
||||
}
|
||||
@@ -132,7 +139,7 @@ func parseOtherFiles(fset *token.FileSet, srcDir, filename string) []*ast.File {
|
||||
files = append(files, f)
|
||||
}
|
||||
|
||||
return files
|
||||
return files, ctx.Err()
|
||||
}
|
||||
|
||||
// addGlobals puts the names of package vars into the provided map.
|
||||
@@ -359,9 +366,7 @@ func (p *pass) load() ([]*ImportFix, bool) {
|
||||
if p.loadRealPackageNames {
|
||||
err := p.loadPackageNames(append(imports, p.candidates...))
|
||||
if err != nil {
|
||||
if p.env.Logf != nil {
|
||||
p.env.Logf("loading package names: %v", err)
|
||||
}
|
||||
p.env.logf("loading package names: %v", err)
|
||||
return nil, false
|
||||
}
|
||||
}
|
||||
@@ -560,6 +565,8 @@ func (p *pass) addCandidate(imp *ImportInfo, pkg *packageInfo) {
|
||||
//
|
||||
// This is declared as a variable rather than a function so goimports can
|
||||
// easily be extended by adding a file with an init function.
|
||||
//
|
||||
// DO NOT REMOVE: used internally at Google.
|
||||
var fixImports = fixImportsDefault
|
||||
|
||||
func fixImportsDefault(fset *token.FileSet, f *ast.File, filename string, env *ProcessEnv) error {
|
||||
@@ -579,9 +586,7 @@ func getFixes(ctx context.Context, fset *token.FileSet, f *ast.File, filename st
|
||||
return nil, err
|
||||
}
|
||||
srcDir := filepath.Dir(abs)
|
||||
if env.Logf != nil {
|
||||
env.Logf("fixImports(filename=%q), abs=%q, srcDir=%q ...", filename, abs, srcDir)
|
||||
}
|
||||
env.logf("fixImports(filename=%q), abs=%q, srcDir=%q ...", filename, abs, srcDir)
|
||||
|
||||
// First pass: looking only at f, and using the naive algorithm to
|
||||
// derive package names from import paths, see if the file is already
|
||||
@@ -592,7 +597,10 @@ func getFixes(ctx context.Context, fset *token.FileSet, f *ast.File, filename st
|
||||
return fixes, nil
|
||||
}
|
||||
|
||||
otherFiles := parseOtherFiles(fset, srcDir, filename)
|
||||
otherFiles, err := parseOtherFiles(ctx, fset, srcDir, filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Second pass: add information from other files in the same package,
|
||||
// like their package vars and imports.
|
||||
@@ -1010,16 +1018,26 @@ func (e *ProcessEnv) GetResolver() (Resolver, error) {
|
||||
// already know the view type.
|
||||
if len(e.Env["GOMOD"]) == 0 && len(e.Env["GOWORK"]) == 0 {
|
||||
e.resolver = newGopathResolver(e)
|
||||
e.logf("created gopath resolver")
|
||||
} else if r, err := newModuleResolver(e, e.ModCache); err != nil {
|
||||
e.resolverErr = err
|
||||
e.logf("failed to create module resolver: %v", err)
|
||||
} else {
|
||||
e.resolver = Resolver(r)
|
||||
e.logf("created module resolver")
|
||||
}
|
||||
}
|
||||
|
||||
return e.resolver, e.resolverErr
|
||||
}
|
||||
|
||||
// logf logs if e.Logf is non-nil.
|
||||
func (e *ProcessEnv) logf(format string, args ...any) {
|
||||
if e.Logf != nil {
|
||||
e.Logf(format, args...)
|
||||
}
|
||||
}
|
||||
|
||||
// buildContext returns the build.Context to use for matching files.
|
||||
//
|
||||
// TODO(rfindley): support dynamic GOOS, GOARCH here, when doing cross-platform
|
||||
@@ -1123,8 +1141,8 @@ type Resolver interface {
|
||||
// scan works with callback to search for packages. See scanCallback for details.
|
||||
scan(ctx context.Context, callback *scanCallback) error
|
||||
|
||||
// loadExports returns the set of exported symbols in the package at dir.
|
||||
// loadExports may be called concurrently.
|
||||
// loadExports returns the package name and set of exported symbols in the
|
||||
// package at dir. loadExports may be called concurrently.
|
||||
loadExports(ctx context.Context, pkg *pkg, includeTest bool) (string, []stdlib.Symbol, error)
|
||||
|
||||
// scoreImportPath returns the relevance for an import path.
|
||||
@@ -1192,7 +1210,7 @@ func addExternalCandidates(ctx context.Context, pass *pass, refs references, fil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = resolver.scan(context.Background(), callback); err != nil {
|
||||
if err = resolver.scan(ctx, callback); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1201,54 +1219,52 @@ func addExternalCandidates(ctx context.Context, pass *pass, refs references, fil
|
||||
imp *ImportInfo
|
||||
pkg *packageInfo
|
||||
}
|
||||
results := make(chan result, len(refs))
|
||||
results := make([]*result, len(refs))
|
||||
|
||||
ctx, cancel := context.WithCancel(context.TODO())
|
||||
var wg sync.WaitGroup
|
||||
defer func() {
|
||||
cancel()
|
||||
wg.Wait()
|
||||
}()
|
||||
var (
|
||||
firstErr error
|
||||
firstErrOnce sync.Once
|
||||
)
|
||||
g, ctx := errgroup.WithContext(ctx)
|
||||
|
||||
searcher := symbolSearcher{
|
||||
logf: pass.env.logf,
|
||||
srcDir: pass.srcDir,
|
||||
xtest: strings.HasSuffix(pass.f.Name.Name, "_test"),
|
||||
loadExports: resolver.loadExports,
|
||||
}
|
||||
|
||||
i := 0
|
||||
for pkgName, symbols := range refs {
|
||||
wg.Add(1)
|
||||
go func(pkgName string, symbols map[string]bool) {
|
||||
defer wg.Done()
|
||||
|
||||
found, err := findImport(ctx, pass, found[pkgName], pkgName, symbols)
|
||||
index := i // claim an index in results
|
||||
i++
|
||||
pkgName := pkgName
|
||||
symbols := symbols
|
||||
|
||||
g.Go(func() error {
|
||||
found, err := searcher.search(ctx, found[pkgName], pkgName, symbols)
|
||||
if err != nil {
|
||||
firstErrOnce.Do(func() {
|
||||
firstErr = err
|
||||
cancel()
|
||||
})
|
||||
return
|
||||
return err
|
||||
}
|
||||
|
||||
if found == nil {
|
||||
return // No matching package.
|
||||
return nil // No matching package.
|
||||
}
|
||||
|
||||
imp := &ImportInfo{
|
||||
ImportPath: found.importPathShort,
|
||||
}
|
||||
|
||||
pkg := &packageInfo{
|
||||
name: pkgName,
|
||||
exports: symbols,
|
||||
}
|
||||
results <- result{imp, pkg}
|
||||
}(pkgName, symbols)
|
||||
results[index] = &result{imp, pkg}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
if err := g.Wait(); err != nil {
|
||||
return err
|
||||
}
|
||||
go func() {
|
||||
wg.Wait()
|
||||
close(results)
|
||||
}()
|
||||
|
||||
for result := range results {
|
||||
for _, result := range results {
|
||||
if result == nil {
|
||||
continue
|
||||
}
|
||||
// Don't offer completions that would shadow predeclared
|
||||
// names, such as github.com/coreos/etcd/error.
|
||||
if types.Universe.Lookup(result.pkg.name) != nil { // predeclared
|
||||
@@ -1262,7 +1278,7 @@ func addExternalCandidates(ctx context.Context, pass *pass, refs references, fil
|
||||
}
|
||||
pass.addCandidate(result.imp, result.pkg)
|
||||
}
|
||||
return firstErr
|
||||
return nil
|
||||
}
|
||||
|
||||
// notIdentifier reports whether ch is an invalid identifier character.
|
||||
@@ -1606,9 +1622,7 @@ func loadExportsFromFiles(ctx context.Context, env *ProcessEnv, dir string, incl
|
||||
fullFile := filepath.Join(dir, fi.Name())
|
||||
f, err := parser.ParseFile(fset, fullFile, nil, 0)
|
||||
if err != nil {
|
||||
if env.Logf != nil {
|
||||
env.Logf("error parsing %v: %v", fullFile, err)
|
||||
}
|
||||
env.logf("error parsing %v: %v", fullFile, err)
|
||||
continue
|
||||
}
|
||||
if f.Name.Name == "documentation" {
|
||||
@@ -1644,9 +1658,7 @@ func loadExportsFromFiles(ctx context.Context, env *ProcessEnv, dir string, incl
|
||||
}
|
||||
sortSymbols(exports)
|
||||
|
||||
if env.Logf != nil {
|
||||
env.Logf("loaded exports in dir %v (package %v): %v", dir, pkgName, exports)
|
||||
}
|
||||
env.logf("loaded exports in dir %v (package %v): %v", dir, pkgName, exports)
|
||||
return pkgName, exports, nil
|
||||
}
|
||||
|
||||
@@ -1656,25 +1668,39 @@ func sortSymbols(syms []stdlib.Symbol) {
|
||||
})
|
||||
}
|
||||
|
||||
// findImport searches for a package with the given symbols.
|
||||
// If no package is found, findImport returns ("", false, nil)
|
||||
func findImport(ctx context.Context, pass *pass, candidates []pkgDistance, pkgName string, symbols map[string]bool) (*pkg, error) {
|
||||
// A symbolSearcher searches for a package with a set of symbols, among a set
|
||||
// of candidates. See [symbolSearcher.search].
|
||||
//
|
||||
// The search occurs within the scope of a single file, with context captured
|
||||
// in srcDir and xtest.
|
||||
type symbolSearcher struct {
|
||||
logf func(string, ...any)
|
||||
srcDir string // directory containing the file
|
||||
xtest bool // if set, the file containing is an x_test file
|
||||
loadExports func(ctx context.Context, pkg *pkg, includeTest bool) (string, []stdlib.Symbol, error)
|
||||
}
|
||||
|
||||
// search searches the provided candidates for a package containing all
|
||||
// exported symbols.
|
||||
//
|
||||
// If successful, returns the resulting package.
|
||||
func (s *symbolSearcher) search(ctx context.Context, candidates []pkgDistance, pkgName string, symbols map[string]bool) (*pkg, error) {
|
||||
// Sort the candidates by their import package length,
|
||||
// assuming that shorter package names are better than long
|
||||
// ones. Note that this sorts by the de-vendored name, so
|
||||
// there's no "penalty" for vendoring.
|
||||
sort.Sort(byDistanceOrImportPathShortLength(candidates))
|
||||
if pass.env.Logf != nil {
|
||||
if s.logf != nil {
|
||||
for i, c := range candidates {
|
||||
pass.env.Logf("%s candidate %d/%d: %v in %v", pkgName, i+1, len(candidates), c.pkg.importPathShort, c.pkg.dir)
|
||||
s.logf("%s candidate %d/%d: %v in %v", pkgName, i+1, len(candidates), c.pkg.importPathShort, c.pkg.dir)
|
||||
}
|
||||
}
|
||||
resolver, err := pass.env.GetResolver()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Collect exports for packages with matching names.
|
||||
// Arrange rescv so that we can we can await results in order of relevance
|
||||
// and exit as soon as we find the first match.
|
||||
//
|
||||
// Search with bounded concurrency, returning as soon as the first result
|
||||
// among rescv is non-nil.
|
||||
rescv := make([]chan *pkg, len(candidates))
|
||||
for i := range candidates {
|
||||
rescv[i] = make(chan *pkg, 1)
|
||||
@@ -1682,6 +1708,7 @@ func findImport(ctx context.Context, pass *pass, candidates []pkgDistance, pkgNa
|
||||
const maxConcurrentPackageImport = 4
|
||||
loadExportsSem := make(chan struct{}, maxConcurrentPackageImport)
|
||||
|
||||
// Ensure that all work is completed at exit.
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
var wg sync.WaitGroup
|
||||
defer func() {
|
||||
@@ -1689,6 +1716,7 @@ func findImport(ctx context.Context, pass *pass, candidates []pkgDistance, pkgNa
|
||||
wg.Wait()
|
||||
}()
|
||||
|
||||
// Start the search.
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
@@ -1699,55 +1727,67 @@ func findImport(ctx context.Context, pass *pass, candidates []pkgDistance, pkgNa
|
||||
return
|
||||
}
|
||||
|
||||
i := i
|
||||
c := c
|
||||
wg.Add(1)
|
||||
go func(c pkgDistance, resc chan<- *pkg) {
|
||||
go func() {
|
||||
defer func() {
|
||||
<-loadExportsSem
|
||||
wg.Done()
|
||||
}()
|
||||
|
||||
if pass.env.Logf != nil {
|
||||
pass.env.Logf("loading exports in dir %s (seeking package %s)", c.pkg.dir, pkgName)
|
||||
if s.logf != nil {
|
||||
s.logf("loading exports in dir %s (seeking package %s)", c.pkg.dir, pkgName)
|
||||
}
|
||||
// If we're an x_test, load the package under test's test variant.
|
||||
includeTest := strings.HasSuffix(pass.f.Name.Name, "_test") && c.pkg.dir == pass.srcDir
|
||||
_, exports, err := resolver.loadExports(ctx, c.pkg, includeTest)
|
||||
pkg, err := s.searchOne(ctx, c, symbols)
|
||||
if err != nil {
|
||||
if pass.env.Logf != nil {
|
||||
pass.env.Logf("loading exports in dir %s (seeking package %s): %v", c.pkg.dir, pkgName, err)
|
||||
if s.logf != nil && ctx.Err() == nil {
|
||||
s.logf("loading exports in dir %s (seeking package %s): %v", c.pkg.dir, pkgName, err)
|
||||
}
|
||||
resc <- nil
|
||||
return
|
||||
pkg = nil
|
||||
}
|
||||
|
||||
exportsMap := make(map[string]bool, len(exports))
|
||||
for _, sym := range exports {
|
||||
exportsMap[sym.Name] = true
|
||||
}
|
||||
|
||||
// If it doesn't have the right
|
||||
// symbols, send nil to mean no match.
|
||||
for symbol := range symbols {
|
||||
if !exportsMap[symbol] {
|
||||
resc <- nil
|
||||
return
|
||||
}
|
||||
}
|
||||
resc <- c.pkg
|
||||
}(c, rescv[i])
|
||||
rescv[i] <- pkg // may be nil
|
||||
}()
|
||||
}
|
||||
}()
|
||||
|
||||
// Await the first (best) result.
|
||||
for _, resc := range rescv {
|
||||
pkg := <-resc
|
||||
if pkg == nil {
|
||||
continue
|
||||
select {
|
||||
case r := <-resc:
|
||||
if r != nil {
|
||||
return r, nil
|
||||
}
|
||||
case <-ctx.Done():
|
||||
return nil, ctx.Err()
|
||||
}
|
||||
return pkg, nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *symbolSearcher) searchOne(ctx context.Context, c pkgDistance, symbols map[string]bool) (*pkg, error) {
|
||||
if ctx.Err() != nil {
|
||||
return nil, ctx.Err()
|
||||
}
|
||||
// If we're considering the package under test from an x_test, load the
|
||||
// test variant.
|
||||
includeTest := s.xtest && c.pkg.dir == s.srcDir
|
||||
_, exports, err := s.loadExports(ctx, c.pkg, includeTest)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
exportsMap := make(map[string]bool, len(exports))
|
||||
for _, sym := range exports {
|
||||
exportsMap[sym.Name] = true
|
||||
}
|
||||
for symbol := range symbols {
|
||||
if !exportsMap[symbol] {
|
||||
return nil, nil // no match
|
||||
}
|
||||
}
|
||||
return c.pkg, nil
|
||||
}
|
||||
|
||||
// pkgIsCandidate reports whether pkg is a candidate for satisfying the
|
||||
// finding which package pkgIdent in the file named by filename is trying
|
||||
// to refer to.
|
||||
@@ -1767,58 +1807,24 @@ func pkgIsCandidate(filename string, refs references, pkg *pkg) bool {
|
||||
}
|
||||
|
||||
// Speed optimization to minimize disk I/O:
|
||||
// the last two components on disk must contain the
|
||||
// package name somewhere.
|
||||
//
|
||||
// This permits mismatch naming like directory
|
||||
// "go-foo" being package "foo", or "pkg.v3" being "pkg",
|
||||
// or directory "google.golang.org/api/cloudbilling/v1"
|
||||
// being package "cloudbilling", but doesn't
|
||||
// permit a directory "foo" to be package
|
||||
// "bar", which is strongly discouraged
|
||||
// anyway. There's no reason goimports needs
|
||||
// to be slow just to accommodate that.
|
||||
// Use the matchesPath heuristic to filter to package paths that could
|
||||
// reasonably match a dangling reference.
|
||||
//
|
||||
// This permits mismatch naming like directory "go-foo" being package "foo",
|
||||
// or "pkg.v3" being "pkg", or directory
|
||||
// "google.golang.org/api/cloudbilling/v1" being package "cloudbilling", but
|
||||
// doesn't permit a directory "foo" to be package "bar", which is strongly
|
||||
// discouraged anyway. There's no reason goimports needs to be slow just to
|
||||
// accommodate that.
|
||||
for pkgIdent := range refs {
|
||||
lastTwo := lastTwoComponents(pkg.importPathShort)
|
||||
if strings.Contains(lastTwo, pkgIdent) {
|
||||
return true
|
||||
}
|
||||
if hasHyphenOrUpperASCII(lastTwo) && !hasHyphenOrUpperASCII(pkgIdent) {
|
||||
lastTwo = lowerASCIIAndRemoveHyphen(lastTwo)
|
||||
if strings.Contains(lastTwo, pkgIdent) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func hasHyphenOrUpperASCII(s string) bool {
|
||||
for i := 0; i < len(s); i++ {
|
||||
b := s[i]
|
||||
if b == '-' || ('A' <= b && b <= 'Z') {
|
||||
if matchesPath(pkgIdent, pkg.importPathShort) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func lowerASCIIAndRemoveHyphen(s string) (ret string) {
|
||||
buf := make([]byte, 0, len(s))
|
||||
for i := 0; i < len(s); i++ {
|
||||
b := s[i]
|
||||
switch {
|
||||
case b == '-':
|
||||
continue
|
||||
case 'A' <= b && b <= 'Z':
|
||||
buf = append(buf, b+('a'-'A'))
|
||||
default:
|
||||
buf = append(buf, b)
|
||||
}
|
||||
}
|
||||
return string(buf)
|
||||
}
|
||||
|
||||
// canUse reports whether the package in dir is usable from filename,
|
||||
// respecting the Go "internal" and "vendor" visibility rules.
|
||||
func canUse(filename, dir string) bool {
|
||||
@@ -1859,19 +1865,84 @@ func canUse(filename, dir string) bool {
|
||||
return !strings.Contains(relSlash, "/vendor/") && !strings.Contains(relSlash, "/internal/") && !strings.HasSuffix(relSlash, "/internal")
|
||||
}
|
||||
|
||||
// lastTwoComponents returns at most the last two path components
|
||||
// of v, using either / or \ as the path separator.
|
||||
func lastTwoComponents(v string) string {
|
||||
// matchesPath reports whether ident may match a potential package name
|
||||
// referred to by path, using heuristics to filter out unidiomatic package
|
||||
// names.
|
||||
//
|
||||
// Specifically, it checks whether either of the last two '/'- or '\'-delimited
|
||||
// path segments matches the identifier. The segment-matching heuristic must
|
||||
// allow for various conventions around segment naming, including go-foo,
|
||||
// foo-go, and foo.v3. To handle all of these, matching considers both (1) the
|
||||
// entire segment, ignoring '-' and '.', as well as (2) the last subsegment
|
||||
// separated by '-' or '.'. So the segment foo-go matches all of the following
|
||||
// identifiers: foo, go, and foogo. All matches are case insensitive (for ASCII
|
||||
// identifiers).
|
||||
//
|
||||
// See the docstring for [pkgIsCandidate] for an explanation of how this
|
||||
// heuristic filters potential candidate packages.
|
||||
func matchesPath(ident, path string) bool {
|
||||
// Ignore case, for ASCII.
|
||||
lowerIfASCII := func(b byte) byte {
|
||||
if 'A' <= b && b <= 'Z' {
|
||||
return b + ('a' - 'A')
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// match reports whether path[start:end] matches ident, ignoring [.-].
|
||||
match := func(start, end int) bool {
|
||||
ii := len(ident) - 1 // current byte in ident
|
||||
pi := end - 1 // current byte in path
|
||||
for ; pi >= start && ii >= 0; pi-- {
|
||||
pb := path[pi]
|
||||
if pb == '-' || pb == '.' {
|
||||
continue
|
||||
}
|
||||
pb = lowerIfASCII(pb)
|
||||
ib := lowerIfASCII(ident[ii])
|
||||
if pb != ib {
|
||||
return false
|
||||
}
|
||||
ii--
|
||||
}
|
||||
return ii < 0 && pi < start // all bytes matched
|
||||
}
|
||||
|
||||
// segmentEnd and subsegmentEnd hold the end points of the current segment
|
||||
// and subsegment intervals.
|
||||
segmentEnd := len(path)
|
||||
subsegmentEnd := len(path)
|
||||
|
||||
// Count slashes; we only care about the last two segments.
|
||||
nslash := 0
|
||||
for i := len(v) - 1; i >= 0; i-- {
|
||||
if v[i] == '/' || v[i] == '\\' {
|
||||
|
||||
for i := len(path) - 1; i >= 0; i-- {
|
||||
switch b := path[i]; b {
|
||||
// TODO(rfindley): we handle backlashes here only because the previous
|
||||
// heuristic handled backslashes. This is perhaps overly defensive, but is
|
||||
// the result of many lessons regarding Chesterton's fence and the
|
||||
// goimports codebase.
|
||||
//
|
||||
// However, this function is only ever called with something called an
|
||||
// 'importPath'. Is it possible that this is a real import path, and
|
||||
// therefore we need only consider forward slashes?
|
||||
case '/', '\\':
|
||||
if match(i+1, segmentEnd) || match(i+1, subsegmentEnd) {
|
||||
return true
|
||||
}
|
||||
nslash++
|
||||
if nslash == 2 {
|
||||
return v[i:]
|
||||
return false // did not match above
|
||||
}
|
||||
segmentEnd, subsegmentEnd = i, i // reset
|
||||
case '-', '.':
|
||||
if match(i+1, subsegmentEnd) {
|
||||
return true
|
||||
}
|
||||
subsegmentEnd = i
|
||||
}
|
||||
}
|
||||
return v
|
||||
return match(0, segmentEnd) || match(0, subsegmentEnd)
|
||||
}
|
||||
|
||||
type visitFn func(node ast.Node) ast.Visitor
|
||||
|
||||
8
vendor/golang.org/x/tools/internal/imports/mod.go
generated
vendored
8
vendor/golang.org/x/tools/internal/imports/mod.go
generated
vendored
@@ -265,9 +265,7 @@ func (r *ModuleResolver) initAllMods() error {
|
||||
return err
|
||||
}
|
||||
if mod.Dir == "" {
|
||||
if r.env.Logf != nil {
|
||||
r.env.Logf("module %v has not been downloaded and will be ignored", mod.Path)
|
||||
}
|
||||
r.env.logf("module %v has not been downloaded and will be ignored", mod.Path)
|
||||
// Can't do anything with a module that's not downloaded.
|
||||
continue
|
||||
}
|
||||
@@ -766,9 +764,7 @@ func (r *ModuleResolver) scanDirForPackage(root gopathwalk.Root, dir string) dir
|
||||
}
|
||||
modPath, err := module.UnescapePath(filepath.ToSlash(matches[1]))
|
||||
if err != nil {
|
||||
if r.env.Logf != nil {
|
||||
r.env.Logf("decoding module cache path %q: %v", subdir, err)
|
||||
}
|
||||
r.env.logf("decoding module cache path %q: %v", subdir, err)
|
||||
return directoryPackageInfo{
|
||||
status: directoryScanned,
|
||||
err: fmt.Errorf("decoding module cache path %q: %v", subdir, err),
|
||||
|
||||
111
vendor/golang.org/x/tools/internal/stdlib/manifest.go
generated
vendored
111
vendor/golang.org/x/tools/internal/stdlib/manifest.go
generated
vendored
@@ -23,6 +23,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"ErrWriteAfterClose", Var, 0},
|
||||
{"ErrWriteTooLong", Var, 0},
|
||||
{"FileInfoHeader", Func, 1},
|
||||
{"FileInfoNames", Type, 23},
|
||||
{"Format", Type, 10},
|
||||
{"FormatGNU", Const, 10},
|
||||
{"FormatPAX", Const, 10},
|
||||
@@ -820,6 +821,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*ConnectionState).ExportKeyingMaterial", Method, 11},
|
||||
{"(*Dialer).Dial", Method, 15},
|
||||
{"(*Dialer).DialContext", Method, 15},
|
||||
{"(*ECHRejectionError).Error", Method, 23},
|
||||
{"(*QUICConn).Close", Method, 21},
|
||||
{"(*QUICConn).ConnectionState", Method, 21},
|
||||
{"(*QUICConn).HandleData", Method, 21},
|
||||
@@ -827,6 +829,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*QUICConn).SendSessionTicket", Method, 21},
|
||||
{"(*QUICConn).SetTransportParameters", Method, 21},
|
||||
{"(*QUICConn).Start", Method, 21},
|
||||
{"(*QUICConn).StoreSession", Method, 23},
|
||||
{"(*SessionState).Bytes", Method, 21},
|
||||
{"(AlertError).Error", Method, 21},
|
||||
{"(ClientAuthType).String", Method, 15},
|
||||
@@ -877,6 +880,8 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Config.ClientSessionCache", Field, 3},
|
||||
{"Config.CurvePreferences", Field, 3},
|
||||
{"Config.DynamicRecordSizingDisabled", Field, 7},
|
||||
{"Config.EncryptedClientHelloConfigList", Field, 23},
|
||||
{"Config.EncryptedClientHelloRejectionVerify", Field, 23},
|
||||
{"Config.GetCertificate", Field, 4},
|
||||
{"Config.GetClientCertificate", Field, 8},
|
||||
{"Config.GetConfigForClient", Field, 8},
|
||||
@@ -902,6 +907,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"ConnectionState", Type, 0},
|
||||
{"ConnectionState.CipherSuite", Field, 0},
|
||||
{"ConnectionState.DidResume", Field, 1},
|
||||
{"ConnectionState.ECHAccepted", Field, 23},
|
||||
{"ConnectionState.HandshakeComplete", Field, 0},
|
||||
{"ConnectionState.NegotiatedProtocol", Field, 0},
|
||||
{"ConnectionState.NegotiatedProtocolIsMutual", Field, 0},
|
||||
@@ -925,6 +931,8 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"ECDSAWithP384AndSHA384", Const, 8},
|
||||
{"ECDSAWithP521AndSHA512", Const, 8},
|
||||
{"ECDSAWithSHA1", Const, 10},
|
||||
{"ECHRejectionError", Type, 23},
|
||||
{"ECHRejectionError.RetryConfigList", Field, 23},
|
||||
{"Ed25519", Const, 13},
|
||||
{"InsecureCipherSuites", Func, 14},
|
||||
{"Listen", Func, 0},
|
||||
@@ -943,6 +951,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"ParseSessionState", Func, 21},
|
||||
{"QUICClient", Func, 21},
|
||||
{"QUICConfig", Type, 21},
|
||||
{"QUICConfig.EnableStoreSessionEvent", Field, 23},
|
||||
{"QUICConfig.TLSConfig", Field, 21},
|
||||
{"QUICConn", Type, 21},
|
||||
{"QUICEncryptionLevel", Type, 21},
|
||||
@@ -954,16 +963,20 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"QUICEvent.Data", Field, 21},
|
||||
{"QUICEvent.Kind", Field, 21},
|
||||
{"QUICEvent.Level", Field, 21},
|
||||
{"QUICEvent.SessionState", Field, 23},
|
||||
{"QUICEvent.Suite", Field, 21},
|
||||
{"QUICEventKind", Type, 21},
|
||||
{"QUICHandshakeDone", Const, 21},
|
||||
{"QUICNoEvent", Const, 21},
|
||||
{"QUICRejectedEarlyData", Const, 21},
|
||||
{"QUICResumeSession", Const, 23},
|
||||
{"QUICServer", Func, 21},
|
||||
{"QUICSessionTicketOptions", Type, 21},
|
||||
{"QUICSessionTicketOptions.EarlyData", Field, 21},
|
||||
{"QUICSessionTicketOptions.Extra", Field, 23},
|
||||
{"QUICSetReadSecret", Const, 21},
|
||||
{"QUICSetWriteSecret", Const, 21},
|
||||
{"QUICStoreSession", Const, 23},
|
||||
{"QUICTransportParameters", Const, 21},
|
||||
{"QUICTransportParametersRequired", Const, 21},
|
||||
{"QUICWriteData", Const, 21},
|
||||
@@ -1036,6 +1049,8 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*Certificate).Verify", Method, 0},
|
||||
{"(*Certificate).VerifyHostname", Method, 0},
|
||||
{"(*CertificateRequest).CheckSignature", Method, 5},
|
||||
{"(*OID).UnmarshalBinary", Method, 23},
|
||||
{"(*OID).UnmarshalText", Method, 23},
|
||||
{"(*RevocationList).CheckSignatureFrom", Method, 19},
|
||||
{"(CertificateInvalidError).Error", Method, 0},
|
||||
{"(ConstraintViolationError).Error", Method, 0},
|
||||
@@ -1043,6 +1058,8 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(InsecureAlgorithmError).Error", Method, 6},
|
||||
{"(OID).Equal", Method, 22},
|
||||
{"(OID).EqualASN1OID", Method, 22},
|
||||
{"(OID).MarshalBinary", Method, 23},
|
||||
{"(OID).MarshalText", Method, 23},
|
||||
{"(OID).String", Method, 22},
|
||||
{"(PublicKeyAlgorithm).String", Method, 10},
|
||||
{"(SignatureAlgorithm).String", Method, 6},
|
||||
@@ -1196,6 +1213,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"ParseCertificates", Func, 0},
|
||||
{"ParseDERCRL", Func, 0},
|
||||
{"ParseECPrivateKey", Func, 1},
|
||||
{"ParseOID", Func, 23},
|
||||
{"ParsePKCS1PrivateKey", Func, 0},
|
||||
{"ParsePKCS1PublicKey", Func, 10},
|
||||
{"ParsePKCS8PrivateKey", Func, 0},
|
||||
@@ -2541,6 +2559,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"PT_NOTE", Const, 0},
|
||||
{"PT_NULL", Const, 0},
|
||||
{"PT_OPENBSD_BOOTDATA", Const, 16},
|
||||
{"PT_OPENBSD_NOBTCFI", Const, 23},
|
||||
{"PT_OPENBSD_RANDOMIZE", Const, 16},
|
||||
{"PT_OPENBSD_WXNEEDED", Const, 16},
|
||||
{"PT_PAX_FLAGS", Const, 16},
|
||||
@@ -3620,13 +3639,16 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"STT_COMMON", Const, 0},
|
||||
{"STT_FILE", Const, 0},
|
||||
{"STT_FUNC", Const, 0},
|
||||
{"STT_GNU_IFUNC", Const, 23},
|
||||
{"STT_HIOS", Const, 0},
|
||||
{"STT_HIPROC", Const, 0},
|
||||
{"STT_LOOS", Const, 0},
|
||||
{"STT_LOPROC", Const, 0},
|
||||
{"STT_NOTYPE", Const, 0},
|
||||
{"STT_OBJECT", Const, 0},
|
||||
{"STT_RELC", Const, 23},
|
||||
{"STT_SECTION", Const, 0},
|
||||
{"STT_SRELC", Const, 23},
|
||||
{"STT_TLS", Const, 0},
|
||||
{"STV_DEFAULT", Const, 0},
|
||||
{"STV_HIDDEN", Const, 0},
|
||||
@@ -4544,11 +4566,14 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"URLEncoding", Var, 0},
|
||||
},
|
||||
"encoding/binary": {
|
||||
{"Append", Func, 23},
|
||||
{"AppendByteOrder", Type, 19},
|
||||
{"AppendUvarint", Func, 19},
|
||||
{"AppendVarint", Func, 19},
|
||||
{"BigEndian", Var, 0},
|
||||
{"ByteOrder", Type, 0},
|
||||
{"Decode", Func, 23},
|
||||
{"Encode", Func, 23},
|
||||
{"LittleEndian", Var, 0},
|
||||
{"MaxVarintLen16", Const, 0},
|
||||
{"MaxVarintLen32", Const, 0},
|
||||
@@ -5308,6 +5333,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"ParenExpr.Rparen", Field, 0},
|
||||
{"ParenExpr.X", Field, 0},
|
||||
{"Pkg", Const, 0},
|
||||
{"Preorder", Func, 23},
|
||||
{"Print", Func, 0},
|
||||
{"RECV", Const, 0},
|
||||
{"RangeStmt", Type, 0},
|
||||
@@ -5898,7 +5924,12 @@ var PackageSymbols = map[string][]Symbol{
|
||||
},
|
||||
"go/types": {
|
||||
{"(*Alias).Obj", Method, 22},
|
||||
{"(*Alias).Origin", Method, 23},
|
||||
{"(*Alias).Rhs", Method, 23},
|
||||
{"(*Alias).SetTypeParams", Method, 23},
|
||||
{"(*Alias).String", Method, 22},
|
||||
{"(*Alias).TypeArgs", Method, 23},
|
||||
{"(*Alias).TypeParams", Method, 23},
|
||||
{"(*Alias).Underlying", Method, 22},
|
||||
{"(*ArgumentError).Error", Method, 18},
|
||||
{"(*ArgumentError).Unwrap", Method, 18},
|
||||
@@ -5943,6 +5974,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*Func).Pkg", Method, 5},
|
||||
{"(*Func).Pos", Method, 5},
|
||||
{"(*Func).Scope", Method, 5},
|
||||
{"(*Func).Signature", Method, 23},
|
||||
{"(*Func).String", Method, 5},
|
||||
{"(*Func).Type", Method, 5},
|
||||
{"(*Info).ObjectOf", Method, 5},
|
||||
@@ -6992,6 +7024,12 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"TempFile", Func, 0},
|
||||
{"WriteFile", Func, 0},
|
||||
},
|
||||
"iter": {
|
||||
{"Pull", Func, 23},
|
||||
{"Pull2", Func, 23},
|
||||
{"Seq", Type, 23},
|
||||
{"Seq2", Type, 23},
|
||||
},
|
||||
"log": {
|
||||
{"(*Logger).Fatal", Method, 0},
|
||||
{"(*Logger).Fatalf", Method, 0},
|
||||
@@ -7222,11 +7260,16 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Writer", Type, 0},
|
||||
},
|
||||
"maps": {
|
||||
{"All", Func, 23},
|
||||
{"Clone", Func, 21},
|
||||
{"Collect", Func, 23},
|
||||
{"Copy", Func, 21},
|
||||
{"DeleteFunc", Func, 21},
|
||||
{"Equal", Func, 21},
|
||||
{"EqualFunc", Func, 21},
|
||||
{"Insert", Func, 23},
|
||||
{"Keys", Func, 23},
|
||||
{"Values", Func, 23},
|
||||
},
|
||||
"math": {
|
||||
{"Abs", Func, 0},
|
||||
@@ -7617,6 +7660,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
},
|
||||
"math/rand/v2": {
|
||||
{"(*ChaCha8).MarshalBinary", Method, 22},
|
||||
{"(*ChaCha8).Read", Method, 23},
|
||||
{"(*ChaCha8).Seed", Method, 22},
|
||||
{"(*ChaCha8).Uint64", Method, 22},
|
||||
{"(*ChaCha8).UnmarshalBinary", Method, 22},
|
||||
@@ -7636,6 +7680,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*Rand).NormFloat64", Method, 22},
|
||||
{"(*Rand).Perm", Method, 22},
|
||||
{"(*Rand).Shuffle", Method, 22},
|
||||
{"(*Rand).Uint", Method, 23},
|
||||
{"(*Rand).Uint32", Method, 22},
|
||||
{"(*Rand).Uint32N", Method, 22},
|
||||
{"(*Rand).Uint64", Method, 22},
|
||||
@@ -7663,6 +7708,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Rand", Type, 22},
|
||||
{"Shuffle", Func, 22},
|
||||
{"Source", Type, 22},
|
||||
{"Uint", Func, 23},
|
||||
{"Uint32", Func, 22},
|
||||
{"Uint32N", Func, 22},
|
||||
{"Uint64", Func, 22},
|
||||
@@ -7743,6 +7789,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*DNSError).Error", Method, 0},
|
||||
{"(*DNSError).Temporary", Method, 0},
|
||||
{"(*DNSError).Timeout", Method, 0},
|
||||
{"(*DNSError).Unwrap", Method, 23},
|
||||
{"(*Dialer).Dial", Method, 1},
|
||||
{"(*Dialer).DialContext", Method, 7},
|
||||
{"(*Dialer).MultipathTCP", Method, 21},
|
||||
@@ -7809,6 +7856,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*TCPConn).RemoteAddr", Method, 0},
|
||||
{"(*TCPConn).SetDeadline", Method, 0},
|
||||
{"(*TCPConn).SetKeepAlive", Method, 0},
|
||||
{"(*TCPConn).SetKeepAliveConfig", Method, 23},
|
||||
{"(*TCPConn).SetKeepAlivePeriod", Method, 2},
|
||||
{"(*TCPConn).SetLinger", Method, 0},
|
||||
{"(*TCPConn).SetNoDelay", Method, 0},
|
||||
@@ -7922,6 +7970,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"DNSError.IsTimeout", Field, 0},
|
||||
{"DNSError.Name", Field, 0},
|
||||
{"DNSError.Server", Field, 0},
|
||||
{"DNSError.UnwrapErr", Field, 23},
|
||||
{"DefaultResolver", Var, 8},
|
||||
{"Dial", Func, 0},
|
||||
{"DialIP", Func, 0},
|
||||
@@ -7937,6 +7986,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Dialer.DualStack", Field, 2},
|
||||
{"Dialer.FallbackDelay", Field, 5},
|
||||
{"Dialer.KeepAlive", Field, 3},
|
||||
{"Dialer.KeepAliveConfig", Field, 23},
|
||||
{"Dialer.LocalAddr", Field, 1},
|
||||
{"Dialer.Resolver", Field, 8},
|
||||
{"Dialer.Timeout", Field, 1},
|
||||
@@ -7989,10 +8039,16 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Interfaces", Func, 0},
|
||||
{"InvalidAddrError", Type, 0},
|
||||
{"JoinHostPort", Func, 0},
|
||||
{"KeepAliveConfig", Type, 23},
|
||||
{"KeepAliveConfig.Count", Field, 23},
|
||||
{"KeepAliveConfig.Enable", Field, 23},
|
||||
{"KeepAliveConfig.Idle", Field, 23},
|
||||
{"KeepAliveConfig.Interval", Field, 23},
|
||||
{"Listen", Func, 0},
|
||||
{"ListenConfig", Type, 11},
|
||||
{"ListenConfig.Control", Field, 11},
|
||||
{"ListenConfig.KeepAlive", Field, 13},
|
||||
{"ListenConfig.KeepAliveConfig", Field, 23},
|
||||
{"ListenIP", Func, 0},
|
||||
{"ListenMulticastUDP", Func, 0},
|
||||
{"ListenPacket", Func, 0},
|
||||
@@ -8081,6 +8137,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*Request).Context", Method, 7},
|
||||
{"(*Request).Cookie", Method, 0},
|
||||
{"(*Request).Cookies", Method, 0},
|
||||
{"(*Request).CookiesNamed", Method, 23},
|
||||
{"(*Request).FormFile", Method, 0},
|
||||
{"(*Request).FormValue", Method, 0},
|
||||
{"(*Request).MultipartReader", Method, 0},
|
||||
@@ -8148,7 +8205,9 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Cookie.HttpOnly", Field, 0},
|
||||
{"Cookie.MaxAge", Field, 0},
|
||||
{"Cookie.Name", Field, 0},
|
||||
{"Cookie.Partitioned", Field, 23},
|
||||
{"Cookie.Path", Field, 0},
|
||||
{"Cookie.Quoted", Field, 23},
|
||||
{"Cookie.Raw", Field, 0},
|
||||
{"Cookie.RawExpires", Field, 0},
|
||||
{"Cookie.SameSite", Field, 11},
|
||||
@@ -8225,7 +8284,9 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"NoBody", Var, 8},
|
||||
{"NotFound", Func, 0},
|
||||
{"NotFoundHandler", Func, 0},
|
||||
{"ParseCookie", Func, 23},
|
||||
{"ParseHTTPVersion", Func, 0},
|
||||
{"ParseSetCookie", Func, 23},
|
||||
{"ParseTime", Func, 1},
|
||||
{"Post", Func, 0},
|
||||
{"PostForm", Func, 0},
|
||||
@@ -8252,6 +8313,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Request.Host", Field, 0},
|
||||
{"Request.Method", Field, 0},
|
||||
{"Request.MultipartForm", Field, 0},
|
||||
{"Request.Pattern", Field, 23},
|
||||
{"Request.PostForm", Field, 1},
|
||||
{"Request.Proto", Field, 0},
|
||||
{"Request.ProtoMajor", Field, 0},
|
||||
@@ -8453,6 +8515,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"DefaultRemoteAddr", Const, 0},
|
||||
{"NewRecorder", Func, 0},
|
||||
{"NewRequest", Func, 7},
|
||||
{"NewRequestWithContext", Func, 23},
|
||||
{"NewServer", Func, 0},
|
||||
{"NewTLSServer", Func, 0},
|
||||
{"NewUnstartedServer", Func, 0},
|
||||
@@ -8917,6 +8980,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Chown", Func, 0},
|
||||
{"Chtimes", Func, 0},
|
||||
{"Clearenv", Func, 0},
|
||||
{"CopyFS", Func, 23},
|
||||
{"Create", Func, 0},
|
||||
{"CreateTemp", Func, 16},
|
||||
{"DevNull", Const, 0},
|
||||
@@ -9150,6 +9214,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"IsLocal", Func, 20},
|
||||
{"Join", Func, 0},
|
||||
{"ListSeparator", Const, 0},
|
||||
{"Localize", Func, 23},
|
||||
{"Match", Func, 0},
|
||||
{"Rel", Func, 0},
|
||||
{"Separator", Const, 0},
|
||||
@@ -9232,6 +9297,8 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(Value).Pointer", Method, 0},
|
||||
{"(Value).Recv", Method, 0},
|
||||
{"(Value).Send", Method, 0},
|
||||
{"(Value).Seq", Method, 23},
|
||||
{"(Value).Seq2", Method, 23},
|
||||
{"(Value).Set", Method, 0},
|
||||
{"(Value).SetBool", Method, 0},
|
||||
{"(Value).SetBytes", Method, 0},
|
||||
@@ -9314,6 +9381,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"SelectSend", Const, 1},
|
||||
{"SendDir", Const, 0},
|
||||
{"Slice", Const, 0},
|
||||
{"SliceAt", Func, 23},
|
||||
{"SliceHeader", Type, 0},
|
||||
{"SliceHeader.Cap", Field, 0},
|
||||
{"SliceHeader.Data", Field, 0},
|
||||
@@ -9655,6 +9723,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"BuildSetting", Type, 18},
|
||||
{"BuildSetting.Key", Field, 18},
|
||||
{"BuildSetting.Value", Field, 18},
|
||||
{"CrashOptions", Type, 23},
|
||||
{"FreeOSMemory", Func, 1},
|
||||
{"GCStats", Type, 1},
|
||||
{"GCStats.LastGC", Field, 1},
|
||||
@@ -9672,6 +9741,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"PrintStack", Func, 0},
|
||||
{"ReadBuildInfo", Func, 12},
|
||||
{"ReadGCStats", Func, 1},
|
||||
{"SetCrashOutput", Func, 23},
|
||||
{"SetGCPercent", Func, 1},
|
||||
{"SetMaxStack", Func, 2},
|
||||
{"SetMaxThreads", Func, 2},
|
||||
@@ -9742,10 +9812,15 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"WithRegion", Func, 11},
|
||||
},
|
||||
"slices": {
|
||||
{"All", Func, 23},
|
||||
{"AppendSeq", Func, 23},
|
||||
{"Backward", Func, 23},
|
||||
{"BinarySearch", Func, 21},
|
||||
{"BinarySearchFunc", Func, 21},
|
||||
{"Chunk", Func, 23},
|
||||
{"Clip", Func, 21},
|
||||
{"Clone", Func, 21},
|
||||
{"Collect", Func, 23},
|
||||
{"Compact", Func, 21},
|
||||
{"CompactFunc", Func, 21},
|
||||
{"Compare", Func, 21},
|
||||
@@ -9767,11 +9842,16 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"MaxFunc", Func, 21},
|
||||
{"Min", Func, 21},
|
||||
{"MinFunc", Func, 21},
|
||||
{"Repeat", Func, 23},
|
||||
{"Replace", Func, 21},
|
||||
{"Reverse", Func, 21},
|
||||
{"Sort", Func, 21},
|
||||
{"SortFunc", Func, 21},
|
||||
{"SortStableFunc", Func, 21},
|
||||
{"Sorted", Func, 23},
|
||||
{"SortedFunc", Func, 23},
|
||||
{"SortedStableFunc", Func, 23},
|
||||
{"Values", Func, 23},
|
||||
},
|
||||
"sort": {
|
||||
{"(Float64Slice).Len", Method, 0},
|
||||
@@ -9936,10 +10016,14 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"TrimSpace", Func, 0},
|
||||
{"TrimSuffix", Func, 1},
|
||||
},
|
||||
"structs": {
|
||||
{"HostLayout", Type, 23},
|
||||
},
|
||||
"sync": {
|
||||
{"(*Cond).Broadcast", Method, 0},
|
||||
{"(*Cond).Signal", Method, 0},
|
||||
{"(*Cond).Wait", Method, 0},
|
||||
{"(*Map).Clear", Method, 23},
|
||||
{"(*Map).CompareAndDelete", Method, 20},
|
||||
{"(*Map).CompareAndSwap", Method, 20},
|
||||
{"(*Map).Delete", Method, 9},
|
||||
@@ -9986,13 +10070,17 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*Bool).Store", Method, 19},
|
||||
{"(*Bool).Swap", Method, 19},
|
||||
{"(*Int32).Add", Method, 19},
|
||||
{"(*Int32).And", Method, 23},
|
||||
{"(*Int32).CompareAndSwap", Method, 19},
|
||||
{"(*Int32).Load", Method, 19},
|
||||
{"(*Int32).Or", Method, 23},
|
||||
{"(*Int32).Store", Method, 19},
|
||||
{"(*Int32).Swap", Method, 19},
|
||||
{"(*Int64).Add", Method, 19},
|
||||
{"(*Int64).And", Method, 23},
|
||||
{"(*Int64).CompareAndSwap", Method, 19},
|
||||
{"(*Int64).Load", Method, 19},
|
||||
{"(*Int64).Or", Method, 23},
|
||||
{"(*Int64).Store", Method, 19},
|
||||
{"(*Int64).Swap", Method, 19},
|
||||
{"(*Pointer).CompareAndSwap", Method, 19},
|
||||
@@ -10000,18 +10088,24 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*Pointer).Store", Method, 19},
|
||||
{"(*Pointer).Swap", Method, 19},
|
||||
{"(*Uint32).Add", Method, 19},
|
||||
{"(*Uint32).And", Method, 23},
|
||||
{"(*Uint32).CompareAndSwap", Method, 19},
|
||||
{"(*Uint32).Load", Method, 19},
|
||||
{"(*Uint32).Or", Method, 23},
|
||||
{"(*Uint32).Store", Method, 19},
|
||||
{"(*Uint32).Swap", Method, 19},
|
||||
{"(*Uint64).Add", Method, 19},
|
||||
{"(*Uint64).And", Method, 23},
|
||||
{"(*Uint64).CompareAndSwap", Method, 19},
|
||||
{"(*Uint64).Load", Method, 19},
|
||||
{"(*Uint64).Or", Method, 23},
|
||||
{"(*Uint64).Store", Method, 19},
|
||||
{"(*Uint64).Swap", Method, 19},
|
||||
{"(*Uintptr).Add", Method, 19},
|
||||
{"(*Uintptr).And", Method, 23},
|
||||
{"(*Uintptr).CompareAndSwap", Method, 19},
|
||||
{"(*Uintptr).Load", Method, 19},
|
||||
{"(*Uintptr).Or", Method, 23},
|
||||
{"(*Uintptr).Store", Method, 19},
|
||||
{"(*Uintptr).Swap", Method, 19},
|
||||
{"(*Value).CompareAndSwap", Method, 17},
|
||||
@@ -10023,6 +10117,11 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"AddUint32", Func, 0},
|
||||
{"AddUint64", Func, 0},
|
||||
{"AddUintptr", Func, 0},
|
||||
{"AndInt32", Func, 23},
|
||||
{"AndInt64", Func, 23},
|
||||
{"AndUint32", Func, 23},
|
||||
{"AndUint64", Func, 23},
|
||||
{"AndUintptr", Func, 23},
|
||||
{"Bool", Type, 19},
|
||||
{"CompareAndSwapInt32", Func, 0},
|
||||
{"CompareAndSwapInt64", Func, 0},
|
||||
@@ -10038,6 +10137,11 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"LoadUint32", Func, 0},
|
||||
{"LoadUint64", Func, 0},
|
||||
{"LoadUintptr", Func, 0},
|
||||
{"OrInt32", Func, 23},
|
||||
{"OrInt64", Func, 23},
|
||||
{"OrUint32", Func, 23},
|
||||
{"OrUint64", Func, 23},
|
||||
{"OrUintptr", Func, 23},
|
||||
{"Pointer", Type, 19},
|
||||
{"StoreInt32", Func, 0},
|
||||
{"StoreInt64", Func, 0},
|
||||
@@ -16200,6 +16304,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"WSAEACCES", Const, 2},
|
||||
{"WSAECONNABORTED", Const, 9},
|
||||
{"WSAECONNRESET", Const, 3},
|
||||
{"WSAENOPROTOOPT", Const, 23},
|
||||
{"WSAEnumProtocols", Func, 2},
|
||||
{"WSAID_CONNECTEX", Var, 1},
|
||||
{"WSAIoctl", Func, 0},
|
||||
@@ -17284,6 +17389,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Encode", Func, 0},
|
||||
{"EncodeRune", Func, 0},
|
||||
{"IsSurrogate", Func, 0},
|
||||
{"RuneLen", Func, 23},
|
||||
},
|
||||
"unicode/utf8": {
|
||||
{"AppendRune", Func, 18},
|
||||
@@ -17306,6 +17412,11 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"ValidRune", Func, 1},
|
||||
{"ValidString", Func, 0},
|
||||
},
|
||||
"unique": {
|
||||
{"(Handle).Value", Method, 23},
|
||||
{"Handle", Type, 23},
|
||||
{"Make", Func, 23},
|
||||
},
|
||||
"unsafe": {
|
||||
{"Add", Func, 0},
|
||||
{"Alignof", Func, 0},
|
||||
|
||||
15
vendor/golang.org/x/tools/internal/typesinternal/types.go
generated
vendored
15
vendor/golang.org/x/tools/internal/typesinternal/types.go
generated
vendored
@@ -48,3 +48,18 @@ func ReadGo116ErrorData(err types.Error) (code ErrorCode, start, end token.Pos,
|
||||
}
|
||||
return ErrorCode(data[0]), token.Pos(data[1]), token.Pos(data[2]), true
|
||||
}
|
||||
|
||||
// NameRelativeTo returns a types.Qualifier that qualifies members of
|
||||
// all packages other than pkg, using only the package name.
|
||||
// (By contrast, [types.RelativeTo] uses the complete package path,
|
||||
// which is often excessive.)
|
||||
//
|
||||
// If pkg is nil, it is equivalent to [*types.Package.Name].
|
||||
func NameRelativeTo(pkg *types.Package) types.Qualifier {
|
||||
return func(other *types.Package) string {
|
||||
if pkg != nil && pkg == other {
|
||||
return "" // same package; unqualified
|
||||
}
|
||||
return other.Name()
|
||||
}
|
||||
}
|
||||
|
||||
2
vendor/golang.org/x/tools/internal/versions/types_go122.go
generated
vendored
2
vendor/golang.org/x/tools/internal/versions/types_go122.go
generated
vendored
@@ -12,7 +12,7 @@ import (
|
||||
"go/types"
|
||||
)
|
||||
|
||||
// FileVersions returns a file's Go version.
|
||||
// FileVersion returns a file's Go version.
|
||||
// The reported version is an unknown Future version if a
|
||||
// version cannot be determined.
|
||||
func FileVersion(info *types.Info, file *ast.File) string {
|
||||
|
||||
9
vendor/modules.txt
vendored
9
vendor/modules.txt
vendored
@@ -1513,7 +1513,7 @@ github.com/onsi/ginkgo/v2/internal/parallel_support
|
||||
github.com/onsi/ginkgo/v2/internal/testingtproxy
|
||||
github.com/onsi/ginkgo/v2/reporters
|
||||
github.com/onsi/ginkgo/v2/types
|
||||
# github.com/onsi/gomega v1.33.1
|
||||
# github.com/onsi/gomega v1.34.1
|
||||
## explicit; go 1.20
|
||||
github.com/onsi/gomega
|
||||
github.com/onsi/gomega/format
|
||||
@@ -2152,7 +2152,7 @@ golang.org/x/crypto/ssh
|
||||
golang.org/x/crypto/ssh/agent
|
||||
golang.org/x/crypto/ssh/internal/bcrypt_pbkdf
|
||||
golang.org/x/crypto/ssh/knownhosts
|
||||
# golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3
|
||||
# golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
|
||||
## explicit; go 1.20
|
||||
golang.org/x/exp/constraints
|
||||
golang.org/x/exp/maps
|
||||
@@ -2172,7 +2172,7 @@ golang.org/x/image/math/fixed
|
||||
golang.org/x/image/tiff
|
||||
golang.org/x/image/tiff/lzw
|
||||
golang.org/x/image/vector
|
||||
# golang.org/x/mod v0.17.0
|
||||
# golang.org/x/mod v0.19.0
|
||||
## explicit; go 1.18
|
||||
golang.org/x/mod/internal/lazyregexp
|
||||
golang.org/x/mod/module
|
||||
@@ -2251,13 +2251,12 @@ golang.org/x/text/width
|
||||
# golang.org/x/time v0.5.0
|
||||
## explicit; go 1.18
|
||||
golang.org/x/time/rate
|
||||
# golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d
|
||||
# golang.org/x/tools v0.23.0
|
||||
## explicit; go 1.19
|
||||
golang.org/x/tools/cover
|
||||
golang.org/x/tools/go/ast/astutil
|
||||
golang.org/x/tools/go/ast/inspector
|
||||
golang.org/x/tools/go/gcexportdata
|
||||
golang.org/x/tools/go/internal/packagesdriver
|
||||
golang.org/x/tools/go/packages
|
||||
golang.org/x/tools/go/types/objectpath
|
||||
golang.org/x/tools/imports
|
||||
|
||||
Reference in New Issue
Block a user