mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 12:24:38 +03:00
update to golang.org/x/{crypto,net,text,sync,tools}@latest
This commit is contained in:
12
vendor/golang.org/x/tools/internal/aliases/aliases.go
generated
vendored
12
vendor/golang.org/x/tools/internal/aliases/aliases.go
generated
vendored
@ -16,10 +16,14 @@ import (
|
||||
// NewAlias creates a new TypeName in Package pkg that
|
||||
// is an alias for the type rhs.
|
||||
//
|
||||
// When GoVersion>=1.22 and GODEBUG=gotypesalias=1,
|
||||
// the Type() of the return value is a *types.Alias.
|
||||
func NewAlias(pos token.Pos, pkg *types.Package, name string, rhs types.Type) *types.TypeName {
|
||||
if enabled() {
|
||||
// The enabled parameter determines whether the resulting [TypeName]'s
|
||||
// type is an [types.Alias]. Its value must be the result of a call to
|
||||
// [Enabled], which computes the effective value of
|
||||
// GODEBUG=gotypesalias=... by invoking the type checker. The Enabled
|
||||
// function is expensive and should be called once per task (e.g.
|
||||
// package import), not once per call to NewAlias.
|
||||
func NewAlias(enabled bool, pos token.Pos, pkg *types.Package, name string, rhs types.Type) *types.TypeName {
|
||||
if enabled {
|
||||
tname := types.NewTypeName(pos, pkg, name, nil)
|
||||
newAlias(tname, rhs)
|
||||
return tname
|
||||
|
21
vendor/golang.org/x/tools/internal/aliases/aliases_go121.go
generated
vendored
21
vendor/golang.org/x/tools/internal/aliases/aliases_go121.go
generated
vendored
@ -15,16 +15,21 @@ import (
|
||||
// It will never be created by go/types.
|
||||
type Alias struct{}
|
||||
|
||||
func (*Alias) String() string { panic("unreachable") }
|
||||
|
||||
func (*Alias) Underlying() types.Type { panic("unreachable") }
|
||||
|
||||
func (*Alias) Obj() *types.TypeName { panic("unreachable") }
|
||||
func (*Alias) String() string { panic("unreachable") }
|
||||
func (*Alias) Underlying() types.Type { panic("unreachable") }
|
||||
func (*Alias) Obj() *types.TypeName { panic("unreachable") }
|
||||
func Rhs(alias *Alias) types.Type { panic("unreachable") }
|
||||
func TypeParams(alias *Alias) *types.TypeParamList { panic("unreachable") }
|
||||
func SetTypeParams(alias *Alias, tparams []*types.TypeParam) { panic("unreachable") }
|
||||
func TypeArgs(alias *Alias) *types.TypeList { panic("unreachable") }
|
||||
func Origin(alias *Alias) *Alias { panic("unreachable") }
|
||||
|
||||
// Unalias returns the type t for go <=1.21.
|
||||
func Unalias(t types.Type) types.Type { return t }
|
||||
|
||||
// Always false for go <=1.21. Ignores GODEBUG.
|
||||
func enabled() bool { return false }
|
||||
|
||||
func newAlias(name *types.TypeName, rhs types.Type) *Alias { panic("unreachable") }
|
||||
|
||||
// Enabled reports whether [NewAlias] should create [types.Alias] types.
|
||||
//
|
||||
// Before go1.22, this function always returns false.
|
||||
func Enabled() bool { return false }
|
||||
|
105
vendor/golang.org/x/tools/internal/aliases/aliases_go122.go
generated
vendored
105
vendor/golang.org/x/tools/internal/aliases/aliases_go122.go
generated
vendored
@ -12,14 +12,58 @@ import (
|
||||
"go/parser"
|
||||
"go/token"
|
||||
"go/types"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Alias is an alias of types.Alias.
|
||||
type Alias = types.Alias
|
||||
|
||||
// Rhs returns the type on the right-hand side of the alias declaration.
|
||||
func Rhs(alias *Alias) types.Type {
|
||||
if alias, ok := any(alias).(interface{ Rhs() types.Type }); ok {
|
||||
return alias.Rhs() // go1.23+
|
||||
}
|
||||
|
||||
// go1.22's Alias didn't have the Rhs method,
|
||||
// so Unalias is the best we can do.
|
||||
return Unalias(alias)
|
||||
}
|
||||
|
||||
// TypeParams returns the type parameter list of the alias.
|
||||
func TypeParams(alias *Alias) *types.TypeParamList {
|
||||
if alias, ok := any(alias).(interface{ TypeParams() *types.TypeParamList }); ok {
|
||||
return alias.TypeParams() // go1.23+
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetTypeParams sets the type parameters of the alias type.
|
||||
func SetTypeParams(alias *Alias, tparams []*types.TypeParam) {
|
||||
if alias, ok := any(alias).(interface {
|
||||
SetTypeParams(tparams []*types.TypeParam)
|
||||
}); ok {
|
||||
alias.SetTypeParams(tparams) // go1.23+
|
||||
} else if len(tparams) > 0 {
|
||||
panic("cannot set type parameters of an Alias type in go1.22")
|
||||
}
|
||||
}
|
||||
|
||||
// TypeArgs returns the type arguments used to instantiate the Alias type.
|
||||
func TypeArgs(alias *Alias) *types.TypeList {
|
||||
if alias, ok := any(alias).(interface{ TypeArgs() *types.TypeList }); ok {
|
||||
return alias.TypeArgs() // go1.23+
|
||||
}
|
||||
return nil // empty (go1.22)
|
||||
}
|
||||
|
||||
// Origin returns the generic Alias type of which alias is an instance.
|
||||
// If alias is not an instance of a generic alias, Origin returns alias.
|
||||
func Origin(alias *Alias) *Alias {
|
||||
if alias, ok := any(alias).(interface{ Origin() *types.Alias }); ok {
|
||||
return alias.Origin() // go1.23+
|
||||
}
|
||||
return alias // not an instance of a generic alias (go1.22)
|
||||
}
|
||||
|
||||
// Unalias is a wrapper of types.Unalias.
|
||||
func Unalias(t types.Type) types.Type { return types.Unalias(t) }
|
||||
|
||||
@ -33,40 +77,23 @@ func newAlias(tname *types.TypeName, rhs types.Type) *Alias {
|
||||
return a
|
||||
}
|
||||
|
||||
// enabled returns true when types.Aliases are enabled.
|
||||
func enabled() bool {
|
||||
// Use the gotypesalias value in GODEBUG if set.
|
||||
godebug := os.Getenv("GODEBUG")
|
||||
value := -1 // last set value.
|
||||
for _, f := range strings.Split(godebug, ",") {
|
||||
switch f {
|
||||
case "gotypesalias=1":
|
||||
value = 1
|
||||
case "gotypesalias=0":
|
||||
value = 0
|
||||
}
|
||||
}
|
||||
switch value {
|
||||
case 0:
|
||||
return false
|
||||
case 1:
|
||||
return true
|
||||
default:
|
||||
return aliasesDefault()
|
||||
}
|
||||
// Enabled reports whether [NewAlias] should create [types.Alias] types.
|
||||
//
|
||||
// This function is expensive! Call it sparingly.
|
||||
func Enabled() bool {
|
||||
// The only reliable way to compute the answer is to invoke go/types.
|
||||
// We don't parse the GODEBUG environment variable, because
|
||||
// (a) it's tricky to do so in a manner that is consistent
|
||||
// with the godebug package; in particular, a simple
|
||||
// substring check is not good enough. The value is a
|
||||
// rightmost-wins list of options. But more importantly:
|
||||
// (b) it is impossible to detect changes to the effective
|
||||
// setting caused by os.Setenv("GODEBUG"), as happens in
|
||||
// many tests. Therefore any attempt to cache the result
|
||||
// is just incorrect.
|
||||
fset := token.NewFileSet()
|
||||
f, _ := parser.ParseFile(fset, "a.go", "package p; type A = int", 0)
|
||||
pkg, _ := new(types.Config).Check("p", fset, []*ast.File{f}, nil)
|
||||
_, enabled := pkg.Scope().Lookup("A").Type().(*types.Alias)
|
||||
return enabled
|
||||
}
|
||||
|
||||
// aliasesDefault reports if aliases are enabled by default.
|
||||
func aliasesDefault() bool {
|
||||
// Dynamically check if Aliases will be produced from go/types.
|
||||
aliasesDefaultOnce.Do(func() {
|
||||
fset := token.NewFileSet()
|
||||
f, _ := parser.ParseFile(fset, "a.go", "package p; type A = int", 0)
|
||||
pkg, _ := new(types.Config).Check("p", fset, []*ast.File{f}, nil)
|
||||
_, gotypesaliasDefault = pkg.Scope().Lookup("A").Type().(*types.Alias)
|
||||
})
|
||||
return gotypesaliasDefault
|
||||
}
|
||||
|
||||
var gotypesaliasDefault bool
|
||||
var aliasesDefaultOnce sync.Once
|
||||
|
59
vendor/golang.org/x/tools/internal/event/tag/tag.go
generated
vendored
59
vendor/golang.org/x/tools/internal/event/tag/tag.go
generated
vendored
@ -1,59 +0,0 @@
|
||||
// Copyright 2019 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 tag provides the labels used for telemetry throughout gopls.
|
||||
package tag
|
||||
|
||||
import (
|
||||
"golang.org/x/tools/internal/event/keys"
|
||||
)
|
||||
|
||||
var (
|
||||
// create the label keys we use
|
||||
Method = keys.NewString("method", "")
|
||||
StatusCode = keys.NewString("status.code", "")
|
||||
StatusMessage = keys.NewString("status.message", "")
|
||||
RPCID = keys.NewString("id", "")
|
||||
RPCDirection = keys.NewString("direction", "")
|
||||
File = keys.NewString("file", "")
|
||||
Directory = keys.New("directory", "")
|
||||
URI = keys.New("URI", "")
|
||||
Package = keys.NewString("package", "") // sorted comma-separated list of Package IDs
|
||||
PackagePath = keys.NewString("package_path", "")
|
||||
Query = keys.New("query", "")
|
||||
Snapshot = keys.NewUInt64("snapshot", "")
|
||||
Operation = keys.NewString("operation", "")
|
||||
|
||||
Position = keys.New("position", "")
|
||||
Category = keys.NewString("category", "")
|
||||
PackageCount = keys.NewInt("packages", "")
|
||||
Files = keys.New("files", "")
|
||||
Port = keys.NewInt("port", "")
|
||||
Type = keys.New("type", "")
|
||||
HoverKind = keys.NewString("hoverkind", "")
|
||||
|
||||
NewServer = keys.NewString("new_server", "A new server was added")
|
||||
EndServer = keys.NewString("end_server", "A server was shut down")
|
||||
|
||||
ServerID = keys.NewString("server", "The server ID an event is related to")
|
||||
Logfile = keys.NewString("logfile", "")
|
||||
DebugAddress = keys.NewString("debug_address", "")
|
||||
GoplsPath = keys.NewString("gopls_path", "")
|
||||
ClientID = keys.NewString("client_id", "")
|
||||
|
||||
Level = keys.NewInt("level", "The logging level")
|
||||
)
|
||||
|
||||
var (
|
||||
// create the stats we measure
|
||||
Started = keys.NewInt64("started", "Count of started RPCs.")
|
||||
ReceivedBytes = keys.NewInt64("received_bytes", "Bytes received.") //, unit.Bytes)
|
||||
SentBytes = keys.NewInt64("sent_bytes", "Bytes sent.") //, unit.Bytes)
|
||||
Latency = keys.NewFloat64("latency_ms", "Elapsed time in milliseconds") //, unit.Milliseconds)
|
||||
)
|
||||
|
||||
const (
|
||||
Inbound = "in"
|
||||
Outbound = "out"
|
||||
)
|
19
vendor/golang.org/x/tools/internal/gcimporter/iexport.go
generated
vendored
19
vendor/golang.org/x/tools/internal/gcimporter/iexport.go
generated
vendored
@ -21,7 +21,6 @@ import (
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/tools/go/types/objectpath"
|
||||
"golang.org/x/tools/internal/aliases"
|
||||
@ -529,7 +528,7 @@ func (p *iexporter) doDecl(obj types.Object) {
|
||||
if alias, ok := t.(*aliases.Alias); ok {
|
||||
// Preserve materialized aliases,
|
||||
// even of non-exported types.
|
||||
t = aliasRHS(alias)
|
||||
t = aliases.Rhs(alias)
|
||||
}
|
||||
w.typ(t, obj.Pkg())
|
||||
break
|
||||
@ -1331,19 +1330,3 @@ func (e internalError) Error() string { return "gcimporter: " + string(e) }
|
||||
func internalErrorf(format string, args ...interface{}) error {
|
||||
return internalError(fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
// aliasRHS removes exactly one Alias constructor.
|
||||
func aliasRHS(alias *aliases.Alias) types.Type {
|
||||
// TODO(adonovan): if proposal #66559 is accepted, this will
|
||||
// become Alias.RHS(alias). In the meantime, we must punch
|
||||
// through the drywall.
|
||||
type go123Alias struct {
|
||||
_ *types.TypeName
|
||||
_ *types.TypeParamList
|
||||
RHS types.Type
|
||||
_ types.Type
|
||||
}
|
||||
var raw *go123Alias
|
||||
*(**aliases.Alias)(unsafe.Pointer(&raw)) = alias
|
||||
return raw.RHS
|
||||
}
|
||||
|
4
vendor/golang.org/x/tools/internal/gcimporter/iimport.go
generated
vendored
4
vendor/golang.org/x/tools/internal/gcimporter/iimport.go
generated
vendored
@ -210,6 +210,7 @@ func iimportCommon(fset *token.FileSet, getPackages GetPackagesFunc, data []byte
|
||||
p := iimporter{
|
||||
version: int(version),
|
||||
ipath: path,
|
||||
aliases: aliases.Enabled(),
|
||||
shallow: shallow,
|
||||
reportf: reportf,
|
||||
|
||||
@ -369,6 +370,7 @@ type iimporter struct {
|
||||
version int
|
||||
ipath string
|
||||
|
||||
aliases bool
|
||||
shallow bool
|
||||
reportf ReportFunc // if non-nil, used to report bugs
|
||||
|
||||
@ -567,7 +569,7 @@ func (r *importReader) obj(name string) {
|
||||
// tparams := r.tparamList()
|
||||
// alias.SetTypeParams(tparams)
|
||||
// }
|
||||
r.declare(aliases.NewAlias(pos, r.currPkg, name, typ))
|
||||
r.declare(aliases.NewAlias(r.p.aliases, pos, r.currPkg, name, typ))
|
||||
|
||||
case constTag:
|
||||
typ, val := r.value()
|
||||
|
4
vendor/golang.org/x/tools/internal/gcimporter/ureader_yes.go
generated
vendored
4
vendor/golang.org/x/tools/internal/gcimporter/ureader_yes.go
generated
vendored
@ -26,6 +26,7 @@ type pkgReader struct {
|
||||
|
||||
ctxt *types.Context
|
||||
imports map[string]*types.Package // previously imported packages, indexed by path
|
||||
aliases bool // create types.Alias nodes
|
||||
|
||||
// lazily initialized arrays corresponding to the unified IR
|
||||
// PosBase, Pkg, and Type sections, respectively.
|
||||
@ -99,6 +100,7 @@ func readUnifiedPackage(fset *token.FileSet, ctxt *types.Context, imports map[st
|
||||
|
||||
ctxt: ctxt,
|
||||
imports: imports,
|
||||
aliases: aliases.Enabled(),
|
||||
|
||||
posBases: make([]string, input.NumElems(pkgbits.RelocPosBase)),
|
||||
pkgs: make([]*types.Package, input.NumElems(pkgbits.RelocPkg)),
|
||||
@ -524,7 +526,7 @@ func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) {
|
||||
case pkgbits.ObjAlias:
|
||||
pos := r.pos()
|
||||
typ := r.typ()
|
||||
declare(aliases.NewAlias(pos, objPkg, objName, typ))
|
||||
declare(aliases.NewAlias(r.p.aliases, pos, objPkg, objName, typ))
|
||||
|
||||
case pkgbits.ObjConst:
|
||||
pos := r.pos()
|
||||
|
123
vendor/golang.org/x/tools/internal/gocommand/invoke.go
generated
vendored
123
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"
|
||||
@ -25,7 +27,6 @@ import (
|
||||
"golang.org/x/tools/internal/event"
|
||||
"golang.org/x/tools/internal/event/keys"
|
||||
"golang.org/x/tools/internal/event/label"
|
||||
"golang.org/x/tools/internal/event/tag"
|
||||
)
|
||||
|
||||
// An Runner will run go command invocations and serialize
|
||||
@ -55,11 +56,14 @@ func (runner *Runner) initialize() {
|
||||
// 1.14: go: updating go.mod: existing contents have changed since last read
|
||||
var modConcurrencyError = regexp.MustCompile(`go:.*go.mod.*contents have changed`)
|
||||
|
||||
// verb is an event label for the go command verb.
|
||||
var verb = keys.NewString("verb", "go command verb")
|
||||
// event keys for go command invocations
|
||||
var (
|
||||
verb = keys.NewString("verb", "go command verb")
|
||||
directory = keys.NewString("directory", "")
|
||||
)
|
||||
|
||||
func invLabels(inv Invocation) []label.Label {
|
||||
return []label.Label{verb.Of(inv.Verb), tag.Directory.Of(inv.WorkingDir)}
|
||||
return []label.Label{verb.Of(inv.Verb), directory.Of(inv.WorkingDir)}
|
||||
}
|
||||
|
||||
// Run is a convenience wrapper around RunRaw.
|
||||
@ -165,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
|
||||
|
||||
@ -194,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() {
|
||||
@ -253,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()
|
||||
}
|
||||
@ -268,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)
|
||||
}
|
||||
@ -349,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,
|
||||
@ -375,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 {
|
||||
@ -409,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
|
||||
@ -442,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 {
|
||||
@ -466,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
|
||||
}
|
||||
|
54
vendor/golang.org/x/tools/internal/gocommand/vendor.go
generated
vendored
54
vendor/golang.org/x/tools/internal/gocommand/vendor.go
generated
vendored
@ -107,3 +107,57 @@ func getMainModuleAnd114(ctx context.Context, inv Invocation, r *Runner) (*Modul
|
||||
}
|
||||
return mod, lines[4] == "go1.14", nil
|
||||
}
|
||||
|
||||
// WorkspaceVendorEnabled reports whether workspace vendoring is enabled. It takes a *Runner to execute Go commands
|
||||
// with the supplied context.Context and Invocation. The Invocation can contain pre-defined fields,
|
||||
// of which only Verb and Args are modified to run the appropriate Go command.
|
||||
// Inspired by setDefaultBuildMod in modload/init.go
|
||||
func WorkspaceVendorEnabled(ctx context.Context, inv Invocation, r *Runner) (bool, []*ModuleJSON, error) {
|
||||
inv.Verb = "env"
|
||||
inv.Args = []string{"GOWORK"}
|
||||
stdout, err := r.Run(ctx, inv)
|
||||
if err != nil {
|
||||
return false, nil, err
|
||||
}
|
||||
goWork := string(bytes.TrimSpace(stdout.Bytes()))
|
||||
if fi, err := os.Stat(filepath.Join(filepath.Dir(goWork), "vendor")); err == nil && fi.IsDir() {
|
||||
mainMods, err := getWorkspaceMainModules(ctx, inv, r)
|
||||
if err != nil {
|
||||
return false, nil, err
|
||||
}
|
||||
return true, mainMods, nil
|
||||
}
|
||||
return false, nil, nil
|
||||
}
|
||||
|
||||
// getWorkspaceMainModules gets the main modules' information.
|
||||
// This is the information needed to figure out if vendoring should be enabled.
|
||||
func getWorkspaceMainModules(ctx context.Context, inv Invocation, r *Runner) ([]*ModuleJSON, error) {
|
||||
const format = `{{.Path}}
|
||||
{{.Dir}}
|
||||
{{.GoMod}}
|
||||
{{.GoVersion}}
|
||||
`
|
||||
inv.Verb = "list"
|
||||
inv.Args = []string{"-m", "-f", format}
|
||||
stdout, err := r.Run(ctx, inv)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
lines := strings.Split(strings.TrimSuffix(stdout.String(), "\n"), "\n")
|
||||
if len(lines) < 4 {
|
||||
return nil, fmt.Errorf("unexpected stdout: %q", stdout.String())
|
||||
}
|
||||
mods := make([]*ModuleJSON, 0, len(lines)/4)
|
||||
for i := 0; i < len(lines); i += 4 {
|
||||
mods = append(mods, &ModuleJSON{
|
||||
Path: lines[i],
|
||||
Dir: lines[i+1],
|
||||
GoMod: lines[i+2],
|
||||
GoVersion: lines[i+3],
|
||||
Main: true,
|
||||
})
|
||||
}
|
||||
return mods, nil
|
||||
}
|
||||
|
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},
|
||||
|
4
vendor/golang.org/x/tools/internal/typesinternal/errorcode.go
generated
vendored
4
vendor/golang.org/x/tools/internal/typesinternal/errorcode.go
generated
vendored
@ -1449,10 +1449,10 @@ const (
|
||||
NotAGenericType
|
||||
|
||||
// WrongTypeArgCount occurs when a type or function is instantiated with an
|
||||
// incorrent number of type arguments, including when a generic type or
|
||||
// incorrect number of type arguments, including when a generic type or
|
||||
// function is used without instantiation.
|
||||
//
|
||||
// Errors inolving failed type inference are assigned other error codes.
|
||||
// Errors involving failed type inference are assigned other error codes.
|
||||
//
|
||||
// Example:
|
||||
// type T[p any] int
|
||||
|
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()
|
||||
}
|
||||
}
|
||||
|
13
vendor/golang.org/x/tools/internal/versions/constraint.go
generated
vendored
Normal file
13
vendor/golang.org/x/tools/internal/versions/constraint.go
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright 2024 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 versions
|
||||
|
||||
import "go/build/constraint"
|
||||
|
||||
// ConstraintGoVersion is constraint.GoVersion (if built with go1.21+).
|
||||
// Otherwise nil.
|
||||
//
|
||||
// Deprecate once x/tools is after go1.21.
|
||||
var ConstraintGoVersion func(x constraint.Expr) string
|
14
vendor/golang.org/x/tools/internal/versions/constraint_go121.go
generated
vendored
Normal file
14
vendor/golang.org/x/tools/internal/versions/constraint_go121.go
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright 2024 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.
|
||||
|
||||
//go:build go1.21
|
||||
// +build go1.21
|
||||
|
||||
package versions
|
||||
|
||||
import "go/build/constraint"
|
||||
|
||||
func init() {
|
||||
ConstraintGoVersion = constraint.GoVersion
|
||||
}
|
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 {
|
||||
|
Reference in New Issue
Block a user