mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 05:27:07 +08:00
vendor: github.com/moby/buildkit v0.21.0-rc1
Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
This commit is contained in:
12
vendor/golang.org/x/tools/cmd/stringer/gotypesalias.go
generated
vendored
12
vendor/golang.org/x/tools/cmd/stringer/gotypesalias.go
generated
vendored
@ -1,12 +0,0 @@
|
||||
// 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.23
|
||||
|
||||
//go:debug gotypesalias=1
|
||||
|
||||
package main
|
||||
|
||||
// Materialize aliases whenever the go toolchain version is after 1.23 (#69772).
|
||||
// Remove this file after go.mod >= 1.23 (which implies gotypesalias=1).
|
6
vendor/golang.org/x/tools/cmd/stringer/stringer.go
generated
vendored
6
vendor/golang.org/x/tools/cmd/stringer/stringer.go
generated
vendored
@ -244,10 +244,10 @@ type Generator struct {
|
||||
buf bytes.Buffer // Accumulated output.
|
||||
pkg *Package // Package we are scanning.
|
||||
|
||||
logf func(format string, args ...interface{}) // test logging hook; nil when not testing
|
||||
logf func(format string, args ...any) // test logging hook; nil when not testing
|
||||
}
|
||||
|
||||
func (g *Generator) Printf(format string, args ...interface{}) {
|
||||
func (g *Generator) Printf(format string, args ...any) {
|
||||
fmt.Fprintf(&g.buf, format, args...)
|
||||
}
|
||||
|
||||
@ -279,7 +279,7 @@ type Package struct {
|
||||
func loadPackages(
|
||||
patterns, tags []string,
|
||||
trimPrefix string, lineComment bool,
|
||||
logf func(format string, args ...interface{}),
|
||||
logf func(format string, args ...any),
|
||||
) []*Package {
|
||||
cfg := &packages.Config{
|
||||
Mode: packages.NeedName | packages.NeedTypes | packages.NeedTypesInfo | packages.NeedSyntax | packages.NeedFiles,
|
||||
|
27
vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go
generated
vendored
27
vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go
generated
vendored
@ -106,24 +106,18 @@ func Find(importPath, srcDir string) (filename, path string) {
|
||||
// additional trailing data beyond the end of the export data.
|
||||
func NewReader(r io.Reader) (io.Reader, error) {
|
||||
buf := bufio.NewReader(r)
|
||||
_, size, err := gcimporter.FindExportData(buf)
|
||||
size, err := gcimporter.FindExportData(buf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if size >= 0 {
|
||||
// We were given an archive and found the __.PKGDEF in it.
|
||||
// This tells us the size of the export data, and we don't
|
||||
// need to return the entire file.
|
||||
return &io.LimitedReader{
|
||||
R: buf,
|
||||
N: size,
|
||||
}, nil
|
||||
} else {
|
||||
// We were given an object file. As such, we don't know how large
|
||||
// the export data is and must return the entire file.
|
||||
return buf, nil
|
||||
}
|
||||
// We were given an archive and found the __.PKGDEF in it.
|
||||
// This tells us the size of the export data, and we don't
|
||||
// need to return the entire file.
|
||||
return &io.LimitedReader{
|
||||
R: buf,
|
||||
N: size,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// readAll works the same way as io.ReadAll, but avoids allocations and copies
|
||||
@ -199,10 +193,7 @@ func Read(in io.Reader, fset *token.FileSet, imports map[string]*types.Package,
|
||||
return pkg, err
|
||||
|
||||
default:
|
||||
l := len(data)
|
||||
if l > 10 {
|
||||
l = 10
|
||||
}
|
||||
l := min(len(data), 10)
|
||||
return nil, fmt.Errorf("unexpected export data with prefix %q for path %s", string(data[:l]), path)
|
||||
}
|
||||
}
|
||||
|
9
vendor/golang.org/x/tools/go/packages/external.go
generated
vendored
9
vendor/golang.org/x/tools/go/packages/external.go
generated
vendored
@ -13,6 +13,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"slices"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@ -89,7 +90,7 @@ func findExternalDriver(cfg *Config) driver {
|
||||
const toolPrefix = "GOPACKAGESDRIVER="
|
||||
tool := ""
|
||||
for _, env := range cfg.Env {
|
||||
if val := strings.TrimPrefix(env, toolPrefix); val != env {
|
||||
if val, ok := strings.CutPrefix(env, toolPrefix); ok {
|
||||
tool = val
|
||||
}
|
||||
}
|
||||
@ -131,7 +132,7 @@ func findExternalDriver(cfg *Config) driver {
|
||||
// command.
|
||||
//
|
||||
// (See similar trick in Invocation.run in ../../internal/gocommand/invoke.go)
|
||||
cmd.Env = append(slicesClip(cfg.Env), "PWD="+cfg.Dir)
|
||||
cmd.Env = append(slices.Clip(cfg.Env), "PWD="+cfg.Dir)
|
||||
cmd.Stdin = bytes.NewReader(req)
|
||||
cmd.Stdout = buf
|
||||
cmd.Stderr = stderr
|
||||
@ -150,7 +151,3 @@ func findExternalDriver(cfg *Config) driver {
|
||||
return &response, nil
|
||||
}
|
||||
}
|
||||
|
||||
// slicesClip removes unused capacity from the slice, returning s[:len(s):len(s)].
|
||||
// TODO(adonovan): use go1.21 slices.Clip.
|
||||
func slicesClip[S ~[]E, E any](s S) S { return s[:len(s):len(s)] }
|
||||
|
10
vendor/golang.org/x/tools/go/packages/golist.go
generated
vendored
10
vendor/golang.org/x/tools/go/packages/golist.go
generated
vendored
@ -322,6 +322,7 @@ type jsonPackage struct {
|
||||
ImportPath string
|
||||
Dir string
|
||||
Name string
|
||||
Target string
|
||||
Export string
|
||||
GoFiles []string
|
||||
CompiledGoFiles []string
|
||||
@ -505,13 +506,15 @@ func (state *golistState) createDriverResponse(words ...string) (*DriverResponse
|
||||
pkg := &Package{
|
||||
Name: p.Name,
|
||||
ID: p.ImportPath,
|
||||
Dir: p.Dir,
|
||||
Target: p.Target,
|
||||
GoFiles: absJoin(p.Dir, p.GoFiles, p.CgoFiles),
|
||||
CompiledGoFiles: absJoin(p.Dir, p.CompiledGoFiles),
|
||||
OtherFiles: absJoin(p.Dir, otherFiles(p)...),
|
||||
EmbedFiles: absJoin(p.Dir, p.EmbedFiles),
|
||||
EmbedPatterns: absJoin(p.Dir, p.EmbedPatterns),
|
||||
IgnoredFiles: absJoin(p.Dir, p.IgnoredGoFiles, p.IgnoredOtherFiles),
|
||||
forTest: p.ForTest,
|
||||
ForTest: p.ForTest,
|
||||
depsErrors: p.DepsErrors,
|
||||
Module: p.Module,
|
||||
}
|
||||
@ -795,7 +798,7 @@ func jsonFlag(cfg *Config, goVersion int) string {
|
||||
// Request Dir in the unlikely case Export is not absolute.
|
||||
addFields("Dir", "Export")
|
||||
}
|
||||
if cfg.Mode&needInternalForTest != 0 {
|
||||
if cfg.Mode&NeedForTest != 0 {
|
||||
addFields("ForTest")
|
||||
}
|
||||
if cfg.Mode&needInternalDepsErrors != 0 {
|
||||
@ -810,6 +813,9 @@ func jsonFlag(cfg *Config, goVersion int) string {
|
||||
if cfg.Mode&NeedEmbedPatterns != 0 {
|
||||
addFields("EmbedPatterns")
|
||||
}
|
||||
if cfg.Mode&NeedTarget != 0 {
|
||||
addFields("Target")
|
||||
}
|
||||
return "-json=" + strings.Join(fields, ",")
|
||||
}
|
||||
|
||||
|
2
vendor/golang.org/x/tools/go/packages/loadmode_string.go
generated
vendored
2
vendor/golang.org/x/tools/go/packages/loadmode_string.go
generated
vendored
@ -23,9 +23,11 @@ var modes = [...]struct {
|
||||
{NeedSyntax, "NeedSyntax"},
|
||||
{NeedTypesInfo, "NeedTypesInfo"},
|
||||
{NeedTypesSizes, "NeedTypesSizes"},
|
||||
{NeedForTest, "NeedForTest"},
|
||||
{NeedModule, "NeedModule"},
|
||||
{NeedEmbedFiles, "NeedEmbedFiles"},
|
||||
{NeedEmbedPatterns, "NeedEmbedPatterns"},
|
||||
{NeedTarget, "NeedTarget"},
|
||||
}
|
||||
|
||||
func (mode LoadMode) String() string {
|
||||
|
77
vendor/golang.org/x/tools/go/packages/packages.go
generated
vendored
77
vendor/golang.org/x/tools/go/packages/packages.go
generated
vendored
@ -43,19 +43,33 @@ import (
|
||||
// ID and Errors (if present) will always be filled.
|
||||
// [Load] may return more information than requested.
|
||||
//
|
||||
// The Mode flag is a union of several bits named NeedName,
|
||||
// NeedFiles, and so on, each of which determines whether
|
||||
// a given field of Package (Name, Files, etc) should be
|
||||
// populated.
|
||||
//
|
||||
// For convenience, we provide named constants for the most
|
||||
// common combinations of Need flags:
|
||||
//
|
||||
// [LoadFiles] lists of files in each package
|
||||
// [LoadImports] ... plus imports
|
||||
// [LoadTypes] ... plus type information
|
||||
// [LoadSyntax] ... plus type-annotated syntax
|
||||
// [LoadAllSyntax] ... for all dependencies
|
||||
//
|
||||
// Unfortunately there are a number of open bugs related to
|
||||
// interactions among the LoadMode bits:
|
||||
// - 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
|
||||
// - https://go.dev/issue/56633
|
||||
// - https://go.dev/issue/56677
|
||||
// - https://go.dev/issue/58726
|
||||
// - https://go.dev/issue/63517
|
||||
type LoadMode int
|
||||
|
||||
const (
|
||||
// NeedName adds Name and PkgPath.
|
||||
NeedName LoadMode = 1 << iota
|
||||
|
||||
// NeedFiles adds GoFiles, OtherFiles, and IgnoredFiles
|
||||
// NeedFiles adds Dir, GoFiles, OtherFiles, and IgnoredFiles
|
||||
NeedFiles
|
||||
|
||||
// NeedCompiledGoFiles adds CompiledGoFiles.
|
||||
@ -86,9 +100,10 @@ const (
|
||||
// needInternalDepsErrors adds the internal deps errors field for use by gopls.
|
||||
needInternalDepsErrors
|
||||
|
||||
// needInternalForTest adds the internal forTest field.
|
||||
// NeedForTest adds ForTest.
|
||||
//
|
||||
// Tests must also be set on the context for this field to be populated.
|
||||
needInternalForTest
|
||||
NeedForTest
|
||||
|
||||
// typecheckCgo enables full support for type checking cgo. Requires Go 1.15+.
|
||||
// Modifies CompiledGoFiles and Types, and has no effect on its own.
|
||||
@ -103,41 +118,31 @@ const (
|
||||
// NeedEmbedPatterns adds EmbedPatterns.
|
||||
NeedEmbedPatterns
|
||||
|
||||
// NeedTarget adds Target.
|
||||
NeedTarget
|
||||
|
||||
// Be sure to update loadmode_string.go when adding new items!
|
||||
)
|
||||
|
||||
const (
|
||||
// LoadFiles loads the name and file names for the initial packages.
|
||||
//
|
||||
// Deprecated: LoadFiles exists for historical compatibility
|
||||
// and should not be used. Please directly specify the needed fields using the Need values.
|
||||
LoadFiles = NeedName | NeedFiles | NeedCompiledGoFiles
|
||||
|
||||
// LoadImports loads the name, file names, and import mapping for the initial packages.
|
||||
//
|
||||
// Deprecated: LoadImports exists for historical compatibility
|
||||
// and should not be used. Please directly specify the needed fields using the Need values.
|
||||
LoadImports = LoadFiles | NeedImports
|
||||
|
||||
// LoadTypes loads exported type information for the initial packages.
|
||||
//
|
||||
// Deprecated: LoadTypes exists for historical compatibility
|
||||
// and should not be used. Please directly specify the needed fields using the Need values.
|
||||
LoadTypes = LoadImports | NeedTypes | NeedTypesSizes
|
||||
|
||||
// LoadSyntax loads typed syntax for the initial packages.
|
||||
//
|
||||
// Deprecated: LoadSyntax exists for historical compatibility
|
||||
// and should not be used. Please directly specify the needed fields using the Need values.
|
||||
LoadSyntax = LoadTypes | NeedSyntax | NeedTypesInfo
|
||||
|
||||
// LoadAllSyntax loads typed syntax for the initial packages and all dependencies.
|
||||
//
|
||||
// Deprecated: LoadAllSyntax exists for historical compatibility
|
||||
// and should not be used. Please directly specify the needed fields using the Need values.
|
||||
LoadAllSyntax = LoadSyntax | NeedDeps
|
||||
|
||||
// Deprecated: NeedExportsFile is a historical misspelling of NeedExportFile.
|
||||
//
|
||||
//go:fix inline
|
||||
NeedExportsFile = NeedExportFile
|
||||
)
|
||||
|
||||
@ -158,7 +163,7 @@ type Config struct {
|
||||
// If the user provides a logger, debug logging is enabled.
|
||||
// If the GOPACKAGESDEBUG environment variable is set to true,
|
||||
// but the logger is nil, default to log.Printf.
|
||||
Logf func(format string, args ...interface{})
|
||||
Logf func(format string, args ...any)
|
||||
|
||||
// Dir is the directory in which to run the build system's query tool
|
||||
// that provides information about the packages.
|
||||
@ -434,6 +439,12 @@ type Package struct {
|
||||
// PkgPath is the package path as used by the go/types package.
|
||||
PkgPath string
|
||||
|
||||
// Dir is the directory associated with the package, if it exists.
|
||||
//
|
||||
// For packages listed by the go command, this is the directory containing
|
||||
// the package files.
|
||||
Dir string
|
||||
|
||||
// Errors contains any errors encountered querying the metadata
|
||||
// of the package, or while parsing or type-checking its files.
|
||||
Errors []Error
|
||||
@ -473,6 +484,10 @@ type Package struct {
|
||||
// information for the package as provided by the build system.
|
||||
ExportFile string
|
||||
|
||||
// Target is the absolute install path of the .a file, for libraries,
|
||||
// and of the executable file, for binaries.
|
||||
Target string
|
||||
|
||||
// Imports maps import paths appearing in the package's Go source files
|
||||
// to corresponding loaded Packages.
|
||||
Imports map[string]*Package
|
||||
@ -521,8 +536,8 @@ type Package struct {
|
||||
|
||||
// -- internal --
|
||||
|
||||
// forTest is the package under test, if any.
|
||||
forTest string
|
||||
// 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
|
||||
@ -551,21 +566,17 @@ type ModuleError struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
packagesinternal.GetForTest = func(p interface{}) string {
|
||||
return p.(*Package).forTest
|
||||
}
|
||||
packagesinternal.GetDepsErrors = func(p interface{}) []*packagesinternal.PackageError {
|
||||
packagesinternal.GetDepsErrors = func(p any) []*packagesinternal.PackageError {
|
||||
return p.(*Package).depsErrors
|
||||
}
|
||||
packagesinternal.SetModFile = func(config interface{}, value string) {
|
||||
packagesinternal.SetModFile = func(config any, value string) {
|
||||
config.(*Config).modFile = value
|
||||
}
|
||||
packagesinternal.SetModFlag = func(config interface{}, value string) {
|
||||
packagesinternal.SetModFlag = func(config any, value string) {
|
||||
config.(*Config).modFlag = value
|
||||
}
|
||||
packagesinternal.TypecheckCgo = int(typecheckCgo)
|
||||
packagesinternal.DepsErrors = int(needInternalDepsErrors)
|
||||
packagesinternal.ForTest = int(needInternalForTest)
|
||||
}
|
||||
|
||||
// An Error describes a problem with a package's metadata, syntax, or types.
|
||||
@ -730,7 +741,7 @@ func newLoader(cfg *Config) *loader {
|
||||
if debug {
|
||||
ld.Config.Logf = log.Printf
|
||||
} else {
|
||||
ld.Config.Logf = func(format string, args ...interface{}) {}
|
||||
ld.Config.Logf = func(format string, args ...any) {}
|
||||
}
|
||||
}
|
||||
if ld.Config.Mode == 0 {
|
||||
|
83
vendor/golang.org/x/tools/go/types/typeutil/callee.go
generated
vendored
83
vendor/golang.org/x/tools/go/types/typeutil/callee.go
generated
vendored
@ -7,45 +7,23 @@ package typeutil
|
||||
import (
|
||||
"go/ast"
|
||||
"go/types"
|
||||
|
||||
"golang.org/x/tools/internal/typeparams"
|
||||
_ "unsafe" // for linkname
|
||||
)
|
||||
|
||||
// Callee returns the named target of a function call, if any:
|
||||
// a function, method, builtin, or variable.
|
||||
//
|
||||
// Functions and methods may potentially have type parameters.
|
||||
//
|
||||
// Note: for calls of instantiated functions and methods, Callee returns
|
||||
// the corresponding generic function or method on the generic type.
|
||||
func Callee(info *types.Info, call *ast.CallExpr) types.Object {
|
||||
fun := ast.Unparen(call.Fun)
|
||||
|
||||
// Look through type instantiation if necessary.
|
||||
isInstance := false
|
||||
switch fun.(type) {
|
||||
case *ast.IndexExpr, *ast.IndexListExpr:
|
||||
// When extracting the callee from an *IndexExpr, we need to check that
|
||||
// it is a *types.Func and not a *types.Var.
|
||||
// Example: Don't match a slice m within the expression `m[0]()`.
|
||||
isInstance = true
|
||||
fun, _, _, _ = typeparams.UnpackIndexExpr(fun)
|
||||
}
|
||||
|
||||
var obj types.Object
|
||||
switch fun := fun.(type) {
|
||||
case *ast.Ident:
|
||||
obj = info.Uses[fun] // type, var, builtin, or declared func
|
||||
case *ast.SelectorExpr:
|
||||
if sel, ok := info.Selections[fun]; ok {
|
||||
obj = sel.Obj() // method or field
|
||||
} else {
|
||||
obj = info.Uses[fun.Sel] // qualified identifier?
|
||||
}
|
||||
obj := info.Uses[usedIdent(info, call.Fun)]
|
||||
if obj == nil {
|
||||
return nil
|
||||
}
|
||||
if _, ok := obj.(*types.TypeName); ok {
|
||||
return nil // T(x) is a conversion, not a call
|
||||
}
|
||||
// A Func is required to match instantiations.
|
||||
if _, ok := obj.(*types.Func); isInstance && !ok {
|
||||
return nil // Was not a Func.
|
||||
return nil
|
||||
}
|
||||
return obj
|
||||
}
|
||||
@ -56,13 +34,52 @@ func Callee(info *types.Info, call *ast.CallExpr) types.Object {
|
||||
// Note: for calls of instantiated functions and methods, StaticCallee returns
|
||||
// the corresponding generic function or method on the generic type.
|
||||
func StaticCallee(info *types.Info, call *ast.CallExpr) *types.Func {
|
||||
if f, ok := Callee(info, call).(*types.Func); ok && !interfaceMethod(f) {
|
||||
return f
|
||||
obj := info.Uses[usedIdent(info, call.Fun)]
|
||||
fn, _ := obj.(*types.Func)
|
||||
if fn == nil || interfaceMethod(fn) {
|
||||
return nil
|
||||
}
|
||||
return fn
|
||||
}
|
||||
|
||||
// usedIdent is the implementation of [internal/typesinternal.UsedIdent].
|
||||
// It returns the identifier associated with e.
|
||||
// See typesinternal.UsedIdent for a fuller description.
|
||||
// This function should live in typesinternal, but cannot because it would
|
||||
// create an import cycle.
|
||||
//
|
||||
//go:linkname usedIdent
|
||||
func usedIdent(info *types.Info, e ast.Expr) *ast.Ident {
|
||||
if info.Types == nil || info.Uses == nil {
|
||||
panic("one of info.Types or info.Uses is nil; both must be populated")
|
||||
}
|
||||
// Look through type instantiation if necessary.
|
||||
switch d := ast.Unparen(e).(type) {
|
||||
case *ast.IndexExpr:
|
||||
if info.Types[d.Index].IsType() {
|
||||
e = d.X
|
||||
}
|
||||
case *ast.IndexListExpr:
|
||||
e = d.X
|
||||
}
|
||||
|
||||
switch e := ast.Unparen(e).(type) {
|
||||
// info.Uses always has the object we want, even for selector expressions.
|
||||
// We don't need info.Selections.
|
||||
// See go/types/recording.go:recordSelection.
|
||||
case *ast.Ident:
|
||||
return e
|
||||
case *ast.SelectorExpr:
|
||||
return e.Sel
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// interfaceMethod reports whether its argument is a method of an interface.
|
||||
// This function should live in typesinternal, but cannot because it would create an import cycle.
|
||||
//
|
||||
//go:linkname interfaceMethod
|
||||
func interfaceMethod(f *types.Func) bool {
|
||||
recv := f.Type().(*types.Signature).Recv()
|
||||
recv := f.Signature().Recv()
|
||||
return recv != nil && types.IsInterface(recv.Type())
|
||||
}
|
||||
|
250
vendor/golang.org/x/tools/go/types/typeutil/map.go
generated
vendored
250
vendor/golang.org/x/tools/go/types/typeutil/map.go
generated
vendored
@ -2,30 +2,35 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package typeutil defines various utilities for types, such as Map,
|
||||
// a mapping from types.Type to any values.
|
||||
package typeutil // import "golang.org/x/tools/go/types/typeutil"
|
||||
// Package typeutil defines various utilities for types, such as [Map],
|
||||
// a hash table that maps [types.Type] to any value.
|
||||
package typeutil
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"go/types"
|
||||
"reflect"
|
||||
"hash/maphash"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/tools/internal/typeparams"
|
||||
)
|
||||
|
||||
// Map is a hash-table-based mapping from types (types.Type) to
|
||||
// arbitrary any values. The concrete types that implement
|
||||
// arbitrary values. The concrete types that implement
|
||||
// the Type interface are pointers. Since they are not canonicalized,
|
||||
// == cannot be used to check for equivalence, and thus we cannot
|
||||
// simply use a Go map.
|
||||
//
|
||||
// Just as with map[K]V, a nil *Map is a valid empty map.
|
||||
//
|
||||
// Not thread-safe.
|
||||
// Read-only map operations ([Map.At], [Map.Len], and so on) may
|
||||
// safely be called concurrently.
|
||||
//
|
||||
// TODO(adonovan): deprecate in favor of https://go.dev/issues/69420
|
||||
// and 69559, if the latter proposals for a generic hash-map type and
|
||||
// a types.Hash function are accepted.
|
||||
type Map struct {
|
||||
hasher Hasher // shared by many Maps
|
||||
table map[uint32][]entry // maps hash to bucket; entry.key==nil means unused
|
||||
length int // number of map entries
|
||||
}
|
||||
@ -36,35 +41,17 @@ type entry struct {
|
||||
value any
|
||||
}
|
||||
|
||||
// SetHasher sets the hasher used by Map.
|
||||
// SetHasher has no effect.
|
||||
//
|
||||
// All Hashers are functionally equivalent but contain internal state
|
||||
// used to cache the results of hashing previously seen types.
|
||||
//
|
||||
// A single Hasher created by MakeHasher() may be shared among many
|
||||
// Maps. This is recommended if the instances have many keys in
|
||||
// common, as it will amortize the cost of hash computation.
|
||||
//
|
||||
// A Hasher may grow without bound as new types are seen. Even when a
|
||||
// type is deleted from the map, the Hasher never shrinks, since other
|
||||
// types in the map may reference the deleted type indirectly.
|
||||
//
|
||||
// Hashers are not thread-safe, and read-only operations such as
|
||||
// Map.Lookup require updates to the hasher, so a full Mutex lock (not a
|
||||
// read-lock) is require around all Map operations if a shared
|
||||
// hasher is accessed from multiple threads.
|
||||
//
|
||||
// If SetHasher is not called, the Map will create a private hasher at
|
||||
// the first call to Insert.
|
||||
func (m *Map) SetHasher(hasher Hasher) {
|
||||
m.hasher = hasher
|
||||
}
|
||||
// It is a relic of an optimization that is no longer profitable. Do
|
||||
// not use [Hasher], [MakeHasher], or [SetHasher] in new code.
|
||||
func (m *Map) SetHasher(Hasher) {}
|
||||
|
||||
// Delete removes the entry with the given key, if any.
|
||||
// It returns true if the entry was found.
|
||||
func (m *Map) Delete(key types.Type) bool {
|
||||
if m != nil && m.table != nil {
|
||||
hash := m.hasher.Hash(key)
|
||||
hash := hash(key)
|
||||
bucket := m.table[hash]
|
||||
for i, e := range bucket {
|
||||
if e.key != nil && types.Identical(key, e.key) {
|
||||
@ -83,7 +70,7 @@ func (m *Map) Delete(key types.Type) bool {
|
||||
// The result is nil if the entry is not present.
|
||||
func (m *Map) At(key types.Type) any {
|
||||
if m != nil && m.table != nil {
|
||||
for _, e := range m.table[m.hasher.Hash(key)] {
|
||||
for _, e := range m.table[hash(key)] {
|
||||
if e.key != nil && types.Identical(key, e.key) {
|
||||
return e.value
|
||||
}
|
||||
@ -96,7 +83,7 @@ func (m *Map) At(key types.Type) any {
|
||||
// and returns the previous entry, if any.
|
||||
func (m *Map) Set(key types.Type, value any) (prev any) {
|
||||
if m.table != nil {
|
||||
hash := m.hasher.Hash(key)
|
||||
hash := hash(key)
|
||||
bucket := m.table[hash]
|
||||
var hole *entry
|
||||
for i, e := range bucket {
|
||||
@ -115,10 +102,7 @@ func (m *Map) Set(key types.Type, value any) (prev any) {
|
||||
m.table[hash] = append(bucket, entry{key, value})
|
||||
}
|
||||
} else {
|
||||
if m.hasher.memo == nil {
|
||||
m.hasher = MakeHasher()
|
||||
}
|
||||
hash := m.hasher.Hash(key)
|
||||
hash := hash(key)
|
||||
m.table = map[uint32][]entry{hash: {entry{key, value}}}
|
||||
}
|
||||
|
||||
@ -195,53 +179,35 @@ func (m *Map) KeysString() string {
|
||||
return m.toString(false)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Hasher
|
||||
// -- Hasher --
|
||||
|
||||
// A Hasher maps each type to its hash value.
|
||||
// For efficiency, a hasher uses memoization; thus its memory
|
||||
// footprint grows monotonically over time.
|
||||
// Hashers are not thread-safe.
|
||||
// Hashers have reference semantics.
|
||||
// Call MakeHasher to create a Hasher.
|
||||
type Hasher struct {
|
||||
memo map[types.Type]uint32
|
||||
|
||||
// ptrMap records pointer identity.
|
||||
ptrMap map[any]uint32
|
||||
|
||||
// sigTParams holds type parameters from the signature being hashed.
|
||||
// Signatures are considered identical modulo renaming of type parameters, so
|
||||
// within the scope of a signature type the identity of the signature's type
|
||||
// parameters is just their index.
|
||||
//
|
||||
// Since the language does not currently support referring to uninstantiated
|
||||
// generic types or functions, and instantiated signatures do not have type
|
||||
// parameter lists, we should never encounter a second non-empty type
|
||||
// parameter list when hashing a generic signature.
|
||||
sigTParams *types.TypeParamList
|
||||
// hash returns the hash of type t.
|
||||
// TODO(adonovan): replace by types.Hash when Go proposal #69420 is accepted.
|
||||
func hash(t types.Type) uint32 {
|
||||
return theHasher.Hash(t)
|
||||
}
|
||||
|
||||
// MakeHasher returns a new Hasher instance.
|
||||
func MakeHasher() Hasher {
|
||||
return Hasher{
|
||||
memo: make(map[types.Type]uint32),
|
||||
ptrMap: make(map[any]uint32),
|
||||
sigTParams: nil,
|
||||
}
|
||||
}
|
||||
// A Hasher provides a [Hasher.Hash] method to map a type to its hash value.
|
||||
// Hashers are stateless, and all are equivalent.
|
||||
type Hasher struct{}
|
||||
|
||||
var theHasher Hasher
|
||||
|
||||
// MakeHasher returns Hasher{}.
|
||||
// Hashers are stateless; all are equivalent.
|
||||
func MakeHasher() Hasher { return theHasher }
|
||||
|
||||
// Hash computes a hash value for the given type t such that
|
||||
// Identical(t, t') => Hash(t) == Hash(t').
|
||||
func (h Hasher) Hash(t types.Type) uint32 {
|
||||
hash, ok := h.memo[t]
|
||||
if !ok {
|
||||
hash = h.hashFor(t)
|
||||
h.memo[t] = hash
|
||||
}
|
||||
return hash
|
||||
return hasher{inGenericSig: false}.hash(t)
|
||||
}
|
||||
|
||||
// hasher holds the state of a single Hash traversal: whether we are
|
||||
// inside the signature of a generic function; this is used to
|
||||
// optimize [hasher.hashTypeParam].
|
||||
type hasher struct{ inGenericSig bool }
|
||||
|
||||
// hashString computes the Fowler–Noll–Vo hash of s.
|
||||
func hashString(s string) uint32 {
|
||||
var h uint32
|
||||
@ -252,21 +218,21 @@ func hashString(s string) uint32 {
|
||||
return h
|
||||
}
|
||||
|
||||
// hashFor computes the hash of t.
|
||||
func (h Hasher) hashFor(t types.Type) uint32 {
|
||||
// hash computes the hash of t.
|
||||
func (h hasher) hash(t types.Type) uint32 {
|
||||
// See Identical for rationale.
|
||||
switch t := t.(type) {
|
||||
case *types.Basic:
|
||||
return uint32(t.Kind())
|
||||
|
||||
case *types.Alias:
|
||||
return h.Hash(types.Unalias(t))
|
||||
return h.hash(types.Unalias(t))
|
||||
|
||||
case *types.Array:
|
||||
return 9043 + 2*uint32(t.Len()) + 3*h.Hash(t.Elem())
|
||||
return 9043 + 2*uint32(t.Len()) + 3*h.hash(t.Elem())
|
||||
|
||||
case *types.Slice:
|
||||
return 9049 + 2*h.Hash(t.Elem())
|
||||
return 9049 + 2*h.hash(t.Elem())
|
||||
|
||||
case *types.Struct:
|
||||
var hash uint32 = 9059
|
||||
@ -277,12 +243,12 @@ func (h Hasher) hashFor(t types.Type) uint32 {
|
||||
}
|
||||
hash += hashString(t.Tag(i))
|
||||
hash += hashString(f.Name()) // (ignore f.Pkg)
|
||||
hash += h.Hash(f.Type())
|
||||
hash += h.hash(f.Type())
|
||||
}
|
||||
return hash
|
||||
|
||||
case *types.Pointer:
|
||||
return 9067 + 2*h.Hash(t.Elem())
|
||||
return 9067 + 2*h.hash(t.Elem())
|
||||
|
||||
case *types.Signature:
|
||||
var hash uint32 = 9091
|
||||
@ -290,33 +256,14 @@ func (h Hasher) hashFor(t types.Type) uint32 {
|
||||
hash *= 8863
|
||||
}
|
||||
|
||||
// Use a separate hasher for types inside of the signature, where type
|
||||
// parameter identity is modified to be (index, constraint). We must use a
|
||||
// new memo for this hasher as type identity may be affected by this
|
||||
// masking. For example, in func[T any](*T), the identity of *T depends on
|
||||
// whether we are mapping the argument in isolation, or recursively as part
|
||||
// of hashing the signature.
|
||||
//
|
||||
// We should never encounter a generic signature while hashing another
|
||||
// generic signature, but defensively set sigTParams only if h.mask is
|
||||
// unset.
|
||||
tparams := t.TypeParams()
|
||||
if h.sigTParams == nil && tparams.Len() != 0 {
|
||||
h = Hasher{
|
||||
// There may be something more efficient than discarding the existing
|
||||
// memo, but it would require detecting whether types are 'tainted' by
|
||||
// references to type parameters.
|
||||
memo: make(map[types.Type]uint32),
|
||||
// Re-using ptrMap ensures that pointer identity is preserved in this
|
||||
// hasher.
|
||||
ptrMap: h.ptrMap,
|
||||
sigTParams: tparams,
|
||||
}
|
||||
}
|
||||
if n := tparams.Len(); n > 0 {
|
||||
h.inGenericSig = true // affects constraints, params, and results
|
||||
|
||||
for i := 0; i < tparams.Len(); i++ {
|
||||
tparam := tparams.At(i)
|
||||
hash += 7 * h.Hash(tparam.Constraint())
|
||||
for i := range n {
|
||||
tparam := tparams.At(i)
|
||||
hash += 7 * h.hash(tparam.Constraint())
|
||||
}
|
||||
}
|
||||
|
||||
return hash + 3*h.hashTuple(t.Params()) + 5*h.hashTuple(t.Results())
|
||||
@ -350,17 +297,17 @@ func (h Hasher) hashFor(t types.Type) uint32 {
|
||||
return hash
|
||||
|
||||
case *types.Map:
|
||||
return 9109 + 2*h.Hash(t.Key()) + 3*h.Hash(t.Elem())
|
||||
return 9109 + 2*h.hash(t.Key()) + 3*h.hash(t.Elem())
|
||||
|
||||
case *types.Chan:
|
||||
return 9127 + 2*uint32(t.Dir()) + 3*h.Hash(t.Elem())
|
||||
return 9127 + 2*uint32(t.Dir()) + 3*h.hash(t.Elem())
|
||||
|
||||
case *types.Named:
|
||||
hash := h.hashPtr(t.Obj())
|
||||
hash := h.hashTypeName(t.Obj())
|
||||
targs := t.TypeArgs()
|
||||
for i := 0; i < targs.Len(); i++ {
|
||||
targ := targs.At(i)
|
||||
hash += 2 * h.Hash(targ)
|
||||
hash += 2 * h.hash(targ)
|
||||
}
|
||||
return hash
|
||||
|
||||
@ -374,17 +321,17 @@ func (h Hasher) hashFor(t types.Type) uint32 {
|
||||
panic(fmt.Sprintf("%T: %v", t, t))
|
||||
}
|
||||
|
||||
func (h Hasher) hashTuple(tuple *types.Tuple) uint32 {
|
||||
func (h hasher) hashTuple(tuple *types.Tuple) uint32 {
|
||||
// See go/types.identicalTypes for rationale.
|
||||
n := tuple.Len()
|
||||
hash := 9137 + 2*uint32(n)
|
||||
for i := 0; i < n; i++ {
|
||||
hash += 3 * h.Hash(tuple.At(i).Type())
|
||||
for i := range n {
|
||||
hash += 3 * h.hash(tuple.At(i).Type())
|
||||
}
|
||||
return hash
|
||||
}
|
||||
|
||||
func (h Hasher) hashUnion(t *types.Union) uint32 {
|
||||
func (h hasher) hashUnion(t *types.Union) uint32 {
|
||||
// Hash type restrictions.
|
||||
terms, err := typeparams.UnionTermSet(t)
|
||||
// if err != nil t has invalid type restrictions. Fall back on a non-zero
|
||||
@ -395,11 +342,11 @@ func (h Hasher) hashUnion(t *types.Union) uint32 {
|
||||
return h.hashTermSet(terms)
|
||||
}
|
||||
|
||||
func (h Hasher) hashTermSet(terms []*types.Term) uint32 {
|
||||
func (h hasher) hashTermSet(terms []*types.Term) uint32 {
|
||||
hash := 9157 + 2*uint32(len(terms))
|
||||
for _, term := range terms {
|
||||
// term order is not significant.
|
||||
termHash := h.Hash(term.Type())
|
||||
termHash := h.hash(term.Type())
|
||||
if term.Tilde() {
|
||||
termHash *= 9161
|
||||
}
|
||||
@ -408,36 +355,47 @@ func (h Hasher) hashTermSet(terms []*types.Term) uint32 {
|
||||
return hash
|
||||
}
|
||||
|
||||
// hashTypeParam returns a hash of the type parameter t, with a hash value
|
||||
// depending on whether t is contained in h.sigTParams.
|
||||
//
|
||||
// If h.sigTParams is set and contains t, then we are in the process of hashing
|
||||
// a signature, and the hash value of t must depend only on t's index and
|
||||
// constraint: signatures are considered identical modulo type parameter
|
||||
// renaming. To avoid infinite recursion, we only hash the type parameter
|
||||
// index, and rely on types.Identical to handle signatures where constraints
|
||||
// are not identical.
|
||||
//
|
||||
// Otherwise the hash of t depends only on t's pointer identity.
|
||||
func (h Hasher) hashTypeParam(t *types.TypeParam) uint32 {
|
||||
if h.sigTParams != nil {
|
||||
i := t.Index()
|
||||
if i >= 0 && i < h.sigTParams.Len() && t == h.sigTParams.At(i) {
|
||||
return 9173 + 3*uint32(i)
|
||||
}
|
||||
// hashTypeParam returns the hash of a type parameter.
|
||||
func (h hasher) hashTypeParam(t *types.TypeParam) uint32 {
|
||||
// Within the signature of a generic function, TypeParams are
|
||||
// identical if they have the same index and constraint, so we
|
||||
// hash them based on index.
|
||||
//
|
||||
// When we are outside a generic function, free TypeParams are
|
||||
// identical iff they are the same object, so we can use a
|
||||
// more discriminating hash consistent with object identity.
|
||||
// This optimization saves [Map] about 4% when hashing all the
|
||||
// types.Info.Types in the forward closure of net/http.
|
||||
if !h.inGenericSig {
|
||||
// Optimization: outside a generic function signature,
|
||||
// use a more discrimating hash consistent with object identity.
|
||||
return h.hashTypeName(t.Obj())
|
||||
}
|
||||
return h.hashPtr(t.Obj())
|
||||
return 9173 + 3*uint32(t.Index())
|
||||
}
|
||||
|
||||
// hashPtr hashes the pointer identity of ptr. It uses h.ptrMap to ensure that
|
||||
// pointers values are not dependent on the GC.
|
||||
func (h Hasher) hashPtr(ptr any) uint32 {
|
||||
if hash, ok := h.ptrMap[ptr]; ok {
|
||||
return hash
|
||||
var theSeed = maphash.MakeSeed()
|
||||
|
||||
// hashTypeName hashes the pointer of tname.
|
||||
func (hasher) hashTypeName(tname *types.TypeName) uint32 {
|
||||
// Since types.Identical uses == to compare TypeNames,
|
||||
// the Hash function uses maphash.Comparable.
|
||||
// TODO(adonovan): or will, when it becomes available in go1.24.
|
||||
// In the meantime we use the pointer's numeric value.
|
||||
//
|
||||
// hash := maphash.Comparable(theSeed, tname)
|
||||
//
|
||||
// (Another approach would be to hash the name and package
|
||||
// path, and whether or not it is a package-level typename. It
|
||||
// is rare for a package to define multiple local types with
|
||||
// the same name.)
|
||||
ptr := uintptr(unsafe.Pointer(tname))
|
||||
if unsafe.Sizeof(ptr) == 8 {
|
||||
hash := uint64(ptr)
|
||||
return uint32(hash ^ (hash >> 32))
|
||||
} else {
|
||||
return uint32(ptr)
|
||||
}
|
||||
hash := uint32(reflect.ValueOf(ptr).Pointer())
|
||||
h.ptrMap[ptr] = hash
|
||||
return hash
|
||||
}
|
||||
|
||||
// shallowHash computes a hash of t without looking at any of its
|
||||
@ -454,7 +412,7 @@ func (h Hasher) hashPtr(ptr any) uint32 {
|
||||
// include m itself; there is no mention of the named type X that
|
||||
// might help us break the cycle.
|
||||
// (See comment in go/types.identical, case *Interface, for more.)
|
||||
func (h Hasher) shallowHash(t types.Type) uint32 {
|
||||
func (h hasher) shallowHash(t types.Type) uint32 {
|
||||
// t is the type of an interface method (Signature),
|
||||
// its params or results (Tuples), or their immediate
|
||||
// elements (mostly Slice, Pointer, Basic, Named),
|
||||
@ -475,7 +433,7 @@ func (h Hasher) shallowHash(t types.Type) uint32 {
|
||||
case *types.Tuple:
|
||||
n := t.Len()
|
||||
hash := 9137 + 2*uint32(n)
|
||||
for i := 0; i < n; i++ {
|
||||
for i := range n {
|
||||
hash += 53471161 * h.shallowHash(t.At(i).Type())
|
||||
}
|
||||
return hash
|
||||
@ -508,10 +466,10 @@ func (h Hasher) shallowHash(t types.Type) uint32 {
|
||||
return 9127
|
||||
|
||||
case *types.Named:
|
||||
return h.hashPtr(t.Obj())
|
||||
return h.hashTypeName(t.Obj())
|
||||
|
||||
case *types.TypeParam:
|
||||
return h.hashPtr(t.Obj())
|
||||
return h.hashTypeParam(t)
|
||||
}
|
||||
panic(fmt.Sprintf("shallowHash: %T: %v", t, t))
|
||||
}
|
||||
|
6
vendor/golang.org/x/tools/internal/event/keys/keys.go
generated
vendored
6
vendor/golang.org/x/tools/internal/event/keys/keys.go
generated
vendored
@ -32,7 +32,7 @@ func (k *Value) Format(w io.Writer, buf []byte, l label.Label) {
|
||||
}
|
||||
|
||||
// Get can be used to get a label for the key from a label.Map.
|
||||
func (k *Value) Get(lm label.Map) interface{} {
|
||||
func (k *Value) Get(lm label.Map) any {
|
||||
if t := lm.Find(k); t.Valid() {
|
||||
return k.From(t)
|
||||
}
|
||||
@ -40,10 +40,10 @@ func (k *Value) Get(lm label.Map) interface{} {
|
||||
}
|
||||
|
||||
// From can be used to get a value from a Label.
|
||||
func (k *Value) From(t label.Label) interface{} { return t.UnpackValue() }
|
||||
func (k *Value) From(t label.Label) any { return t.UnpackValue() }
|
||||
|
||||
// Of creates a new Label with this key and the supplied value.
|
||||
func (k *Value) Of(value interface{}) label.Label { return label.OfValue(k, value) }
|
||||
func (k *Value) Of(value any) label.Label { return label.OfValue(k, value) }
|
||||
|
||||
// Tag represents a key for tagging labels that have no value.
|
||||
// These are used when the existence of the label is the entire information it
|
||||
|
13
vendor/golang.org/x/tools/internal/event/label/label.go
generated
vendored
13
vendor/golang.org/x/tools/internal/event/label/label.go
generated
vendored
@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"reflect"
|
||||
"slices"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
@ -32,7 +33,7 @@ type Key interface {
|
||||
type Label struct {
|
||||
key Key
|
||||
packed uint64
|
||||
untyped interface{}
|
||||
untyped any
|
||||
}
|
||||
|
||||
// Map is the interface to a collection of Labels indexed by key.
|
||||
@ -76,13 +77,13 @@ type mapChain struct {
|
||||
// OfValue creates a new label from the key and value.
|
||||
// This method is for implementing new key types, label creation should
|
||||
// normally be done with the Of method of the key.
|
||||
func OfValue(k Key, value interface{}) Label { return Label{key: k, untyped: value} }
|
||||
func OfValue(k Key, value any) Label { return Label{key: k, untyped: value} }
|
||||
|
||||
// UnpackValue assumes the label was built using LabelOfValue and returns the value
|
||||
// that was passed to that constructor.
|
||||
// This method is for implementing new key types, for type safety normal
|
||||
// access should be done with the From method of the key.
|
||||
func (t Label) UnpackValue() interface{} { return t.untyped }
|
||||
func (t Label) UnpackValue() any { return t.untyped }
|
||||
|
||||
// Of64 creates a new label from a key and a uint64. This is often
|
||||
// used for non uint64 values that can be packed into a uint64.
|
||||
@ -154,10 +155,8 @@ func (f *filter) Valid(index int) bool {
|
||||
|
||||
func (f *filter) Label(index int) Label {
|
||||
l := f.underlying.Label(index)
|
||||
for _, f := range f.keys {
|
||||
if l.Key() == f {
|
||||
return Label{}
|
||||
}
|
||||
if slices.Contains(f.keys, l.Key()) {
|
||||
return Label{}
|
||||
}
|
||||
return l
|
||||
}
|
||||
|
2
vendor/golang.org/x/tools/internal/gcimporter/bimport.go
generated
vendored
2
vendor/golang.org/x/tools/internal/gcimporter/bimport.go
generated
vendored
@ -14,7 +14,7 @@ import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
func errorf(format string, args ...interface{}) {
|
||||
func errorf(format string, args ...any) {
|
||||
panic(fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
|
448
vendor/golang.org/x/tools/internal/gcimporter/exportdata.go
generated
vendored
448
vendor/golang.org/x/tools/internal/gcimporter/exportdata.go
generated
vendored
@ -2,49 +2,183 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// This file is a copy of $GOROOT/src/go/internal/gcimporter/exportdata.go.
|
||||
|
||||
// This file implements FindExportData.
|
||||
// This file should be kept in sync with $GOROOT/src/internal/exportdata/exportdata.go.
|
||||
// This file also additionally implements FindExportData for gcexportdata.NewReader.
|
||||
|
||||
package gcimporter
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"go/build"
|
||||
"io"
|
||||
"strconv"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
func readGopackHeader(r *bufio.Reader) (name string, size int64, err error) {
|
||||
// See $GOROOT/include/ar.h.
|
||||
hdr := make([]byte, 16+12+6+6+8+10+2)
|
||||
_, err = io.ReadFull(r, hdr)
|
||||
// FindExportData positions the reader r at the beginning of the
|
||||
// export data section of an underlying cmd/compile created archive
|
||||
// file by reading from it. The reader must be positioned at the
|
||||
// start of the file before calling this function.
|
||||
// This returns the length of the export data in bytes.
|
||||
//
|
||||
// This function is needed by [gcexportdata.Read], which must
|
||||
// accept inputs produced by the last two releases of cmd/compile,
|
||||
// plus tip.
|
||||
func FindExportData(r *bufio.Reader) (size int64, err error) {
|
||||
arsize, err := FindPackageDefinition(r)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
// leave for debugging
|
||||
if false {
|
||||
fmt.Printf("header: %s", hdr)
|
||||
}
|
||||
s := strings.TrimSpace(string(hdr[16+12+6+6+8:][:10]))
|
||||
length, err := strconv.Atoi(s)
|
||||
size = int64(length)
|
||||
if err != nil || hdr[len(hdr)-2] != '`' || hdr[len(hdr)-1] != '\n' {
|
||||
err = fmt.Errorf("invalid archive header")
|
||||
size = int64(arsize)
|
||||
|
||||
objapi, headers, err := ReadObjectHeaders(r)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
name = strings.TrimSpace(string(hdr[:16]))
|
||||
size -= int64(len(objapi))
|
||||
for _, h := range headers {
|
||||
size -= int64(len(h))
|
||||
}
|
||||
|
||||
// Check for the binary export data section header "$$B\n".
|
||||
// TODO(taking): Unify with ReadExportDataHeader so that it stops at the 'u' instead of reading
|
||||
line, err := r.ReadSlice('\n')
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
hdr := string(line)
|
||||
if hdr != "$$B\n" {
|
||||
err = fmt.Errorf("unknown export data header: %q", hdr)
|
||||
return
|
||||
}
|
||||
size -= int64(len(hdr))
|
||||
|
||||
// For files with a binary export data header "$$B\n",
|
||||
// these are always terminated by an end-of-section marker "\n$$\n".
|
||||
// So the last bytes must always be this constant.
|
||||
//
|
||||
// The end-of-section marker is not a part of the export data itself.
|
||||
// Do not include these in size.
|
||||
//
|
||||
// It would be nice to have sanity check that the final bytes after
|
||||
// the export data are indeed the end-of-section marker. The split
|
||||
// of gcexportdata.NewReader and gcexportdata.Read make checking this
|
||||
// ugly so gcimporter gives up enforcing this. The compiler and go/types
|
||||
// importer do enforce this, which seems good enough.
|
||||
const endofsection = "\n$$\n"
|
||||
size -= int64(len(endofsection))
|
||||
|
||||
if size < 0 {
|
||||
err = fmt.Errorf("invalid size (%d) in the archive file: %d bytes remain without section headers (recompile package)", arsize, size)
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// FindExportData positions the reader r at the beginning of the
|
||||
// export data section of an underlying GC-created object/archive
|
||||
// file by reading from it. The reader must be positioned at the
|
||||
// start of the file before calling this function. The hdr result
|
||||
// is the string before the export data, either "$$" or "$$B".
|
||||
// The size result is the length of the export data in bytes, or -1 if not known.
|
||||
func FindExportData(r *bufio.Reader) (hdr string, size int64, err error) {
|
||||
// ReadUnified reads the contents of the unified export data from a reader r
|
||||
// that contains the contents of a GC-created archive file.
|
||||
//
|
||||
// On success, the reader will be positioned after the end-of-section marker "\n$$\n".
|
||||
//
|
||||
// Supported GC-created archive files have 4 layers of nesting:
|
||||
// - An archive file containing a package definition file.
|
||||
// - The package definition file contains headers followed by a data section.
|
||||
// Headers are lines (≤ 4kb) that do not start with "$$".
|
||||
// - The data section starts with "$$B\n" followed by export data followed
|
||||
// by an end of section marker "\n$$\n". (The section start "$$\n" is no
|
||||
// longer supported.)
|
||||
// - The export data starts with a format byte ('u') followed by the <data> in
|
||||
// the given format. (See ReadExportDataHeader for older formats.)
|
||||
//
|
||||
// Putting this together, the bytes in a GC-created archive files are expected
|
||||
// to look like the following.
|
||||
// See cmd/internal/archive for more details on ar file headers.
|
||||
//
|
||||
// | <!arch>\n | ar file signature
|
||||
// | __.PKGDEF...size...\n | ar header for __.PKGDEF including size.
|
||||
// | go object <...>\n | objabi header
|
||||
// | <optional headers>\n | other headers such as build id
|
||||
// | $$B\n | binary format marker
|
||||
// | u<data>\n | unified export <data>
|
||||
// | $$\n | end-of-section marker
|
||||
// | [optional padding] | padding byte (0x0A) if size is odd
|
||||
// | [ar file header] | other ar files
|
||||
// | [ar file data] |
|
||||
func ReadUnified(r *bufio.Reader) (data []byte, err error) {
|
||||
// We historically guaranteed headers at the default buffer size (4096) work.
|
||||
// This ensures we can use ReadSlice throughout.
|
||||
const minBufferSize = 4096
|
||||
r = bufio.NewReaderSize(r, minBufferSize)
|
||||
|
||||
size, err := FindPackageDefinition(r)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
n := size
|
||||
|
||||
objapi, headers, err := ReadObjectHeaders(r)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
n -= len(objapi)
|
||||
for _, h := range headers {
|
||||
n -= len(h)
|
||||
}
|
||||
|
||||
hdrlen, err := ReadExportDataHeader(r)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
n -= hdrlen
|
||||
|
||||
// size also includes the end of section marker. Remove that many bytes from the end.
|
||||
const marker = "\n$$\n"
|
||||
n -= len(marker)
|
||||
|
||||
if n < 0 {
|
||||
err = fmt.Errorf("invalid size (%d) in the archive file: %d bytes remain without section headers (recompile package)", size, n)
|
||||
return
|
||||
}
|
||||
|
||||
// Read n bytes from buf.
|
||||
data = make([]byte, n)
|
||||
_, err = io.ReadFull(r, data)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Check for marker at the end.
|
||||
var suffix [len(marker)]byte
|
||||
_, err = io.ReadFull(r, suffix[:])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if s := string(suffix[:]); s != marker {
|
||||
err = fmt.Errorf("read %q instead of end-of-section marker (%q)", s, marker)
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// FindPackageDefinition positions the reader r at the beginning of a package
|
||||
// definition file ("__.PKGDEF") within a GC-created archive by reading
|
||||
// from it, and returns the size of the package definition file in the archive.
|
||||
//
|
||||
// The reader must be positioned at the start of the archive file before calling
|
||||
// this function, and "__.PKGDEF" is assumed to be the first file in the archive.
|
||||
//
|
||||
// See cmd/internal/archive for details on the archive format.
|
||||
func FindPackageDefinition(r *bufio.Reader) (size int, err error) {
|
||||
// Uses ReadSlice to limit risk of malformed inputs.
|
||||
|
||||
// Read first line to make sure this is an object file.
|
||||
line, err := r.ReadSlice('\n')
|
||||
if err != nil {
|
||||
@ -52,48 +186,236 @@ func FindExportData(r *bufio.Reader) (hdr string, size int64, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
if string(line) == "!<arch>\n" {
|
||||
// Archive file. Scan to __.PKGDEF.
|
||||
var name string
|
||||
if name, size, err = readGopackHeader(r); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// First entry should be __.PKGDEF.
|
||||
if name != "__.PKGDEF" {
|
||||
err = fmt.Errorf("go archive is missing __.PKGDEF")
|
||||
return
|
||||
}
|
||||
|
||||
// Read first line of __.PKGDEF data, so that line
|
||||
// is once again the first line of the input.
|
||||
if line, err = r.ReadSlice('\n'); err != nil {
|
||||
err = fmt.Errorf("can't find export data (%v)", err)
|
||||
return
|
||||
}
|
||||
size -= int64(len(line))
|
||||
}
|
||||
|
||||
// Now at __.PKGDEF in archive or still at beginning of file.
|
||||
// Either way, line should begin with "go object ".
|
||||
if !strings.HasPrefix(string(line), "go object ") {
|
||||
err = fmt.Errorf("not a Go object file")
|
||||
// Is the first line an archive file signature?
|
||||
if string(line) != "!<arch>\n" {
|
||||
err = fmt.Errorf("not the start of an archive file (%q)", line)
|
||||
return
|
||||
}
|
||||
|
||||
// Skip over object header to export data.
|
||||
// Begins after first line starting with $$.
|
||||
for line[0] != '$' {
|
||||
if line, err = r.ReadSlice('\n'); err != nil {
|
||||
err = fmt.Errorf("can't find export data (%v)", err)
|
||||
return
|
||||
}
|
||||
size -= int64(len(line))
|
||||
}
|
||||
hdr = string(line)
|
||||
if size < 0 {
|
||||
size = -1
|
||||
// package export block should be first
|
||||
size = readArchiveHeader(r, "__.PKGDEF")
|
||||
if size <= 0 {
|
||||
err = fmt.Errorf("not a package file")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ReadObjectHeaders reads object headers from the reader. Object headers are
|
||||
// lines that do not start with an end-of-section marker "$$". The first header
|
||||
// is the objabi header. On success, the reader will be positioned at the beginning
|
||||
// of the end-of-section marker.
|
||||
//
|
||||
// It returns an error if any header does not fit in r.Size() bytes.
|
||||
func ReadObjectHeaders(r *bufio.Reader) (objapi string, headers []string, err error) {
|
||||
// line is a temporary buffer for headers.
|
||||
// Use bounded reads (ReadSlice, Peek) to limit risk of malformed inputs.
|
||||
var line []byte
|
||||
|
||||
// objapi header should be the first line
|
||||
if line, err = r.ReadSlice('\n'); err != nil {
|
||||
err = fmt.Errorf("can't find export data (%v)", err)
|
||||
return
|
||||
}
|
||||
objapi = string(line)
|
||||
|
||||
// objapi header begins with "go object ".
|
||||
if !strings.HasPrefix(objapi, "go object ") {
|
||||
err = fmt.Errorf("not a go object file: %s", objapi)
|
||||
return
|
||||
}
|
||||
|
||||
// process remaining object header lines
|
||||
for {
|
||||
// check for an end of section marker "$$"
|
||||
line, err = r.Peek(2)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if string(line) == "$$" {
|
||||
return // stop
|
||||
}
|
||||
|
||||
// read next header
|
||||
line, err = r.ReadSlice('\n')
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
headers = append(headers, string(line))
|
||||
}
|
||||
}
|
||||
|
||||
// ReadExportDataHeader reads the export data header and format from r.
|
||||
// It returns the number of bytes read, or an error if the format is no longer
|
||||
// supported or it failed to read.
|
||||
//
|
||||
// The only currently supported format is binary export data in the
|
||||
// unified export format.
|
||||
func ReadExportDataHeader(r *bufio.Reader) (n int, err error) {
|
||||
// Read export data header.
|
||||
line, err := r.ReadSlice('\n')
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
hdr := string(line)
|
||||
switch hdr {
|
||||
case "$$\n":
|
||||
err = fmt.Errorf("old textual export format no longer supported (recompile package)")
|
||||
return
|
||||
|
||||
case "$$B\n":
|
||||
var format byte
|
||||
format, err = r.ReadByte()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
// The unified export format starts with a 'u'.
|
||||
switch format {
|
||||
case 'u':
|
||||
default:
|
||||
// Older no longer supported export formats include:
|
||||
// indexed export format which started with an 'i'; and
|
||||
// the older binary export format which started with a 'c',
|
||||
// 'd', or 'v' (from "version").
|
||||
err = fmt.Errorf("binary export format %q is no longer supported (recompile package)", format)
|
||||
return
|
||||
}
|
||||
|
||||
default:
|
||||
err = fmt.Errorf("unknown export data header: %q", hdr)
|
||||
return
|
||||
}
|
||||
|
||||
n = len(hdr) + 1 // + 1 is for 'u'
|
||||
return
|
||||
}
|
||||
|
||||
// FindPkg returns the filename and unique package id for an import
|
||||
// path based on package information provided by build.Import (using
|
||||
// the build.Default build.Context). A relative srcDir is interpreted
|
||||
// relative to the current working directory.
|
||||
//
|
||||
// FindPkg is only used in tests within x/tools.
|
||||
func FindPkg(path, srcDir string) (filename, id string, err error) {
|
||||
// TODO(taking): Move internal/exportdata.FindPkg into its own file,
|
||||
// and then this copy into a _test package.
|
||||
if path == "" {
|
||||
return "", "", errors.New("path is empty")
|
||||
}
|
||||
|
||||
var noext string
|
||||
switch {
|
||||
default:
|
||||
// "x" -> "$GOPATH/pkg/$GOOS_$GOARCH/x.ext", "x"
|
||||
// Don't require the source files to be present.
|
||||
if abs, err := filepath.Abs(srcDir); err == nil { // see issue 14282
|
||||
srcDir = abs
|
||||
}
|
||||
var bp *build.Package
|
||||
bp, err = build.Import(path, srcDir, build.FindOnly|build.AllowBinary)
|
||||
if bp.PkgObj == "" {
|
||||
if bp.Goroot && bp.Dir != "" {
|
||||
filename, err = lookupGorootExport(bp.Dir)
|
||||
if err == nil {
|
||||
_, err = os.Stat(filename)
|
||||
}
|
||||
if err == nil {
|
||||
return filename, bp.ImportPath, nil
|
||||
}
|
||||
}
|
||||
goto notfound
|
||||
} else {
|
||||
noext = strings.TrimSuffix(bp.PkgObj, ".a")
|
||||
}
|
||||
id = bp.ImportPath
|
||||
|
||||
case build.IsLocalImport(path):
|
||||
// "./x" -> "/this/directory/x.ext", "/this/directory/x"
|
||||
noext = filepath.Join(srcDir, path)
|
||||
id = noext
|
||||
|
||||
case filepath.IsAbs(path):
|
||||
// for completeness only - go/build.Import
|
||||
// does not support absolute imports
|
||||
// "/x" -> "/x.ext", "/x"
|
||||
noext = path
|
||||
id = path
|
||||
}
|
||||
|
||||
if false { // for debugging
|
||||
if path != id {
|
||||
fmt.Printf("%s -> %s\n", path, id)
|
||||
}
|
||||
}
|
||||
|
||||
// try extensions
|
||||
for _, ext := range pkgExts {
|
||||
filename = noext + ext
|
||||
f, statErr := os.Stat(filename)
|
||||
if statErr == nil && !f.IsDir() {
|
||||
return filename, id, nil
|
||||
}
|
||||
if err == nil {
|
||||
err = statErr
|
||||
}
|
||||
}
|
||||
|
||||
notfound:
|
||||
if err == nil {
|
||||
return "", path, fmt.Errorf("can't find import: %q", path)
|
||||
}
|
||||
return "", path, fmt.Errorf("can't find import: %q: %w", path, err)
|
||||
}
|
||||
|
||||
var pkgExts = [...]string{".a", ".o"} // a file from the build cache will have no extension
|
||||
|
||||
var exportMap sync.Map // package dir → func() (string, error)
|
||||
|
||||
// lookupGorootExport returns the location of the export data
|
||||
// (normally found in the build cache, but located in GOROOT/pkg
|
||||
// in prior Go releases) for the package located in pkgDir.
|
||||
//
|
||||
// (We use the package's directory instead of its import path
|
||||
// mainly to simplify handling of the packages in src/vendor
|
||||
// and cmd/vendor.)
|
||||
//
|
||||
// lookupGorootExport is only used in tests within x/tools.
|
||||
func lookupGorootExport(pkgDir string) (string, error) {
|
||||
f, ok := exportMap.Load(pkgDir)
|
||||
if !ok {
|
||||
var (
|
||||
listOnce sync.Once
|
||||
exportPath string
|
||||
err error
|
||||
)
|
||||
f, _ = exportMap.LoadOrStore(pkgDir, func() (string, error) {
|
||||
listOnce.Do(func() {
|
||||
cmd := exec.Command(filepath.Join(build.Default.GOROOT, "bin", "go"), "list", "-export", "-f", "{{.Export}}", pkgDir)
|
||||
cmd.Dir = build.Default.GOROOT
|
||||
cmd.Env = append(os.Environ(), "PWD="+cmd.Dir, "GOROOT="+build.Default.GOROOT)
|
||||
var output []byte
|
||||
output, err = cmd.Output()
|
||||
if err != nil {
|
||||
if ee, ok := err.(*exec.ExitError); ok && len(ee.Stderr) > 0 {
|
||||
err = errors.New(string(ee.Stderr))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
exports := strings.Split(string(bytes.TrimSpace(output)), "\n")
|
||||
if len(exports) != 1 {
|
||||
err = fmt.Errorf("go list reported %d exports; expected 1", len(exports))
|
||||
return
|
||||
}
|
||||
|
||||
exportPath = exports[0]
|
||||
})
|
||||
|
||||
return exportPath, err
|
||||
})
|
||||
}
|
||||
|
||||
return f.(func() (string, error))()
|
||||
}
|
||||
|
187
vendor/golang.org/x/tools/internal/gcimporter/gcimporter.go
generated
vendored
187
vendor/golang.org/x/tools/internal/gcimporter/gcimporter.go
generated
vendored
@ -23,17 +23,11 @@ package gcimporter // import "golang.org/x/tools/internal/gcimporter"
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"go/build"
|
||||
"go/token"
|
||||
"go/types"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -45,125 +39,14 @@ const (
|
||||
trace = false
|
||||
)
|
||||
|
||||
var exportMap sync.Map // package dir → func() (string, bool)
|
||||
|
||||
// lookupGorootExport returns the location of the export data
|
||||
// (normally found in the build cache, but located in GOROOT/pkg
|
||||
// in prior Go releases) for the package located in pkgDir.
|
||||
//
|
||||
// (We use the package's directory instead of its import path
|
||||
// mainly to simplify handling of the packages in src/vendor
|
||||
// and cmd/vendor.)
|
||||
func lookupGorootExport(pkgDir string) (string, bool) {
|
||||
f, ok := exportMap.Load(pkgDir)
|
||||
if !ok {
|
||||
var (
|
||||
listOnce sync.Once
|
||||
exportPath string
|
||||
)
|
||||
f, _ = exportMap.LoadOrStore(pkgDir, func() (string, bool) {
|
||||
listOnce.Do(func() {
|
||||
cmd := exec.Command("go", "list", "-export", "-f", "{{.Export}}", pkgDir)
|
||||
cmd.Dir = build.Default.GOROOT
|
||||
var output []byte
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
exports := strings.Split(string(bytes.TrimSpace(output)), "\n")
|
||||
if len(exports) != 1 {
|
||||
return
|
||||
}
|
||||
|
||||
exportPath = exports[0]
|
||||
})
|
||||
|
||||
return exportPath, exportPath != ""
|
||||
})
|
||||
}
|
||||
|
||||
return f.(func() (string, bool))()
|
||||
}
|
||||
|
||||
var pkgExts = [...]string{".a", ".o"}
|
||||
|
||||
// FindPkg returns the filename and unique package id for an import
|
||||
// path based on package information provided by build.Import (using
|
||||
// the build.Default build.Context). A relative srcDir is interpreted
|
||||
// relative to the current working directory.
|
||||
// If no file was found, an empty filename is returned.
|
||||
func FindPkg(path, srcDir string) (filename, id string) {
|
||||
if path == "" {
|
||||
return
|
||||
}
|
||||
|
||||
var noext string
|
||||
switch {
|
||||
default:
|
||||
// "x" -> "$GOPATH/pkg/$GOOS_$GOARCH/x.ext", "x"
|
||||
// Don't require the source files to be present.
|
||||
if abs, err := filepath.Abs(srcDir); err == nil { // see issue 14282
|
||||
srcDir = abs
|
||||
}
|
||||
bp, _ := build.Import(path, srcDir, build.FindOnly|build.AllowBinary)
|
||||
if bp.PkgObj == "" {
|
||||
var ok bool
|
||||
if bp.Goroot && bp.Dir != "" {
|
||||
filename, ok = lookupGorootExport(bp.Dir)
|
||||
}
|
||||
if !ok {
|
||||
id = path // make sure we have an id to print in error message
|
||||
return
|
||||
}
|
||||
} else {
|
||||
noext = strings.TrimSuffix(bp.PkgObj, ".a")
|
||||
id = bp.ImportPath
|
||||
}
|
||||
|
||||
case build.IsLocalImport(path):
|
||||
// "./x" -> "/this/directory/x.ext", "/this/directory/x"
|
||||
noext = filepath.Join(srcDir, path)
|
||||
id = noext
|
||||
|
||||
case filepath.IsAbs(path):
|
||||
// for completeness only - go/build.Import
|
||||
// does not support absolute imports
|
||||
// "/x" -> "/x.ext", "/x"
|
||||
noext = path
|
||||
id = path
|
||||
}
|
||||
|
||||
if false { // for debugging
|
||||
if path != id {
|
||||
fmt.Printf("%s -> %s\n", path, id)
|
||||
}
|
||||
}
|
||||
|
||||
if filename != "" {
|
||||
if f, err := os.Stat(filename); err == nil && !f.IsDir() {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// try extensions
|
||||
for _, ext := range pkgExts {
|
||||
filename = noext + ext
|
||||
if f, err := os.Stat(filename); err == nil && !f.IsDir() {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
filename = "" // not found
|
||||
return
|
||||
}
|
||||
|
||||
// Import imports a gc-generated package given its import path and srcDir, adds
|
||||
// the corresponding package object to the packages map, and returns the object.
|
||||
// The packages map must contain all packages already imported.
|
||||
func Import(packages map[string]*types.Package, path, srcDir string, lookup func(path string) (io.ReadCloser, error)) (pkg *types.Package, err error) {
|
||||
//
|
||||
// Import is only used in tests.
|
||||
func Import(fset *token.FileSet, packages map[string]*types.Package, path, srcDir string, lookup func(path string) (io.ReadCloser, error)) (pkg *types.Package, err error) {
|
||||
var rc io.ReadCloser
|
||||
var filename, id string
|
||||
var id string
|
||||
if lookup != nil {
|
||||
// With custom lookup specified, assume that caller has
|
||||
// converted path to a canonical import path for use in the map.
|
||||
@ -182,12 +65,13 @@ func Import(packages map[string]*types.Package, path, srcDir string, lookup func
|
||||
}
|
||||
rc = f
|
||||
} else {
|
||||
filename, id = FindPkg(path, srcDir)
|
||||
var filename string
|
||||
filename, id, err = FindPkg(path, srcDir)
|
||||
if filename == "" {
|
||||
if path == "unsafe" {
|
||||
return types.Unsafe, nil
|
||||
}
|
||||
return nil, fmt.Errorf("can't find import: %q", id)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// no need to re-import if the package was imported completely before
|
||||
@ -210,62 +94,15 @@ func Import(packages map[string]*types.Package, path, srcDir string, lookup func
|
||||
}
|
||||
defer rc.Close()
|
||||
|
||||
var hdr string
|
||||
var size int64
|
||||
buf := bufio.NewReader(rc)
|
||||
if hdr, size, err = FindExportData(buf); err != nil {
|
||||
data, err := ReadUnified(buf)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("import %q: %v", path, err)
|
||||
return
|
||||
}
|
||||
|
||||
switch hdr {
|
||||
case "$$B\n":
|
||||
var data []byte
|
||||
data, err = io.ReadAll(buf)
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
|
||||
// TODO(gri): allow clients of go/importer to provide a FileSet.
|
||||
// Or, define a new standard go/types/gcexportdata package.
|
||||
fset := token.NewFileSet()
|
||||
|
||||
// Select appropriate importer.
|
||||
if len(data) > 0 {
|
||||
switch data[0] {
|
||||
case 'v', 'c', 'd':
|
||||
// binary: emitted by cmd/compile till go1.10; obsolete.
|
||||
return nil, fmt.Errorf("binary (%c) import format is no longer supported", data[0])
|
||||
|
||||
case 'i':
|
||||
// indexed: emitted by cmd/compile till go1.19;
|
||||
// now used only for serializing go/types.
|
||||
// See https://github.com/golang/go/issues/69491.
|
||||
_, pkg, err := IImportData(fset, packages, data[1:], id)
|
||||
return pkg, err
|
||||
|
||||
case 'u':
|
||||
// unified: emitted by cmd/compile since go1.20.
|
||||
_, pkg, err := UImportData(fset, packages, data[1:size], id)
|
||||
return pkg, err
|
||||
|
||||
default:
|
||||
l := len(data)
|
||||
if l > 10 {
|
||||
l = 10
|
||||
}
|
||||
return nil, fmt.Errorf("unexpected export data with prefix %q for path %s", string(data[:l]), id)
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
err = fmt.Errorf("unknown export data header: %q", hdr)
|
||||
}
|
||||
// unified: emitted by cmd/compile since go1.20.
|
||||
_, pkg, err = UImportData(fset, packages, data, id)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
type byPath []*types.Package
|
||||
|
||||
func (a byPath) Len() int { return len(a) }
|
||||
func (a byPath) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||
func (a byPath) Less(i, j int) bool { return a[i].Path() < a[j].Path() }
|
||||
|
40
vendor/golang.org/x/tools/internal/gcimporter/iexport.go
generated
vendored
40
vendor/golang.org/x/tools/internal/gcimporter/iexport.go
generated
vendored
@ -236,6 +236,7 @@ import (
|
||||
"io"
|
||||
"math/big"
|
||||
"reflect"
|
||||
"slices"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -271,10 +272,10 @@ import (
|
||||
// file system, be sure to include a cryptographic digest of the executable in
|
||||
// the key to avoid version skew.
|
||||
//
|
||||
// If the provided reportf func is non-nil, it will be used for reporting bugs
|
||||
// encountered during export.
|
||||
// TODO(rfindley): remove reportf when we are confident enough in the new
|
||||
// objectpath encoding.
|
||||
// If the provided reportf func is non-nil, it is used for reporting
|
||||
// bugs (e.g. recovered panics) encountered during export, enabling us
|
||||
// to obtain via telemetry the stack that would otherwise be lost by
|
||||
// merely returning an error.
|
||||
func IExportShallow(fset *token.FileSet, pkg *types.Package, reportf ReportFunc) ([]byte, error) {
|
||||
// In principle this operation can only fail if out.Write fails,
|
||||
// but that's impossible for bytes.Buffer---and as a matter of
|
||||
@ -283,7 +284,7 @@ func IExportShallow(fset *token.FileSet, pkg *types.Package, reportf ReportFunc)
|
||||
// TODO(adonovan): use byte slices throughout, avoiding copying.
|
||||
const bundle, shallow = false, true
|
||||
var out bytes.Buffer
|
||||
err := iexportCommon(&out, fset, bundle, shallow, iexportVersion, []*types.Package{pkg})
|
||||
err := iexportCommon(&out, fset, bundle, shallow, iexportVersion, []*types.Package{pkg}, reportf)
|
||||
return out.Bytes(), err
|
||||
}
|
||||
|
||||
@ -310,7 +311,7 @@ func IImportShallow(fset *token.FileSet, getPackages GetPackagesFunc, data []byt
|
||||
}
|
||||
|
||||
// ReportFunc is the type of a function used to report formatted bugs.
|
||||
type ReportFunc = func(string, ...interface{})
|
||||
type ReportFunc = func(string, ...any)
|
||||
|
||||
// Current bundled export format version. Increase with each format change.
|
||||
// 0: initial implementation
|
||||
@ -323,20 +324,27 @@ const bundleVersion = 0
|
||||
// so that calls to IImportData can override with a provided package path.
|
||||
func IExportData(out io.Writer, fset *token.FileSet, pkg *types.Package) error {
|
||||
const bundle, shallow = false, false
|
||||
return iexportCommon(out, fset, bundle, shallow, iexportVersion, []*types.Package{pkg})
|
||||
return iexportCommon(out, fset, bundle, shallow, iexportVersion, []*types.Package{pkg}, nil)
|
||||
}
|
||||
|
||||
// IExportBundle writes an indexed export bundle for pkgs to out.
|
||||
func IExportBundle(out io.Writer, fset *token.FileSet, pkgs []*types.Package) error {
|
||||
const bundle, shallow = true, false
|
||||
return iexportCommon(out, fset, bundle, shallow, iexportVersion, pkgs)
|
||||
return iexportCommon(out, fset, bundle, shallow, iexportVersion, pkgs, nil)
|
||||
}
|
||||
|
||||
func iexportCommon(out io.Writer, fset *token.FileSet, bundle, shallow bool, version int, pkgs []*types.Package) (err error) {
|
||||
func iexportCommon(out io.Writer, fset *token.FileSet, bundle, shallow bool, version int, pkgs []*types.Package, reportf ReportFunc) (err error) {
|
||||
if !debug {
|
||||
defer func() {
|
||||
if e := recover(); e != nil {
|
||||
// Report the stack via telemetry (see #71067).
|
||||
if reportf != nil {
|
||||
reportf("panic in exporter")
|
||||
}
|
||||
if ierr, ok := e.(internalError); ok {
|
||||
// internalError usually means we exported a
|
||||
// bad go/types data structure: a violation
|
||||
// of an implicit precondition of Export.
|
||||
err = ierr
|
||||
return
|
||||
}
|
||||
@ -458,7 +466,7 @@ func (p *iexporter) encodeFile(w *intWriter, file *token.File, needed []uint64)
|
||||
w.uint64(size)
|
||||
|
||||
// Sort the set of needed offsets. Duplicates are harmless.
|
||||
sort.Slice(needed, func(i, j int) bool { return needed[i] < needed[j] })
|
||||
slices.Sort(needed)
|
||||
|
||||
lines := file.Lines() // byte offset of each line start
|
||||
w.uint64(uint64(len(lines)))
|
||||
@ -597,7 +605,7 @@ type filePositions struct {
|
||||
needed []uint64 // unordered list of needed file offsets
|
||||
}
|
||||
|
||||
func (p *iexporter) trace(format string, args ...interface{}) {
|
||||
func (p *iexporter) trace(format string, args ...any) {
|
||||
if !trace {
|
||||
// Call sites should also be guarded, but having this check here allows
|
||||
// easily enabling/disabling debug trace statements.
|
||||
@ -812,7 +820,7 @@ func (p *iexporter) doDecl(obj types.Object) {
|
||||
|
||||
n := named.NumMethods()
|
||||
w.uint64(uint64(n))
|
||||
for i := 0; i < n; i++ {
|
||||
for i := range n {
|
||||
m := named.Method(i)
|
||||
w.pos(m.Pos())
|
||||
w.string(m.Name())
|
||||
@ -1089,7 +1097,7 @@ func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) {
|
||||
w.pkg(fieldPkg)
|
||||
w.uint64(uint64(n))
|
||||
|
||||
for i := 0; i < n; i++ {
|
||||
for i := range n {
|
||||
f := t.Field(i)
|
||||
if w.p.shallow {
|
||||
w.objectPath(f)
|
||||
@ -1138,7 +1146,7 @@ func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) {
|
||||
w.startType(unionType)
|
||||
nt := t.Len()
|
||||
w.uint64(uint64(nt))
|
||||
for i := 0; i < nt; i++ {
|
||||
for i := range nt {
|
||||
term := t.Term(i)
|
||||
w.bool(term.Tilde())
|
||||
w.typ(term.Type(), pkg)
|
||||
@ -1267,7 +1275,7 @@ func tparamName(exportName string) string {
|
||||
func (w *exportWriter) paramList(tup *types.Tuple) {
|
||||
n := tup.Len()
|
||||
w.uint64(uint64(n))
|
||||
for i := 0; i < n; i++ {
|
||||
for i := range n {
|
||||
w.param(tup.At(i))
|
||||
}
|
||||
}
|
||||
@ -1583,6 +1591,6 @@ func (e internalError) Error() string { return "gcimporter: " + string(e) }
|
||||
// "internalErrorf" as the former is used for bugs, whose cause is
|
||||
// internal inconsistency, whereas the latter is used for ordinary
|
||||
// situations like bad input, whose cause is external.
|
||||
func internalErrorf(format string, args ...interface{}) error {
|
||||
func internalErrorf(format string, args ...any) error {
|
||||
return internalError(fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
17
vendor/golang.org/x/tools/internal/gcimporter/iimport.go
generated
vendored
17
vendor/golang.org/x/tools/internal/gcimporter/iimport.go
generated
vendored
@ -5,8 +5,6 @@
|
||||
// Indexed package import.
|
||||
// See iexport.go for the export data format.
|
||||
|
||||
// This file is a copy of $GOROOT/src/go/internal/gcimporter/iimport.go.
|
||||
|
||||
package gcimporter
|
||||
|
||||
import (
|
||||
@ -18,6 +16,7 @@ import (
|
||||
"go/types"
|
||||
"io"
|
||||
"math/big"
|
||||
"slices"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
@ -316,7 +315,7 @@ func iimportCommon(fset *token.FileSet, getPackages GetPackagesFunc, data []byte
|
||||
pkgs = pkgList[:1]
|
||||
|
||||
// record all referenced packages as imports
|
||||
list := append(([]*types.Package)(nil), pkgList[1:]...)
|
||||
list := slices.Clone(pkgList[1:])
|
||||
sort.Sort(byPath(list))
|
||||
pkgs[0].SetImports(list)
|
||||
}
|
||||
@ -402,7 +401,7 @@ type iimporter struct {
|
||||
indent int // for tracing support
|
||||
}
|
||||
|
||||
func (p *iimporter) trace(format string, args ...interface{}) {
|
||||
func (p *iimporter) trace(format string, args ...any) {
|
||||
if !trace {
|
||||
// Call sites should also be guarded, but having this check here allows
|
||||
// easily enabling/disabling debug trace statements.
|
||||
@ -673,7 +672,9 @@ func (r *importReader) obj(name string) {
|
||||
case varTag:
|
||||
typ := r.typ()
|
||||
|
||||
r.declare(types.NewVar(pos, r.currPkg, name, typ))
|
||||
v := types.NewVar(pos, r.currPkg, name, typ)
|
||||
typesinternal.SetVarKind(v, typesinternal.PackageVar)
|
||||
r.declare(v)
|
||||
|
||||
default:
|
||||
errorf("unexpected tag: %v", tag)
|
||||
@ -1111,3 +1112,9 @@ func (r *importReader) byte() byte {
|
||||
}
|
||||
return x
|
||||
}
|
||||
|
||||
type byPath []*types.Package
|
||||
|
||||
func (a byPath) Len() int { return len(a) }
|
||||
func (a byPath) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||
func (a byPath) Less(i, j int) bool { return a[i].Path() < a[j].Path() }
|
||||
|
30
vendor/golang.org/x/tools/internal/gcimporter/support.go
generated
vendored
Normal file
30
vendor/golang.org/x/tools/internal/gcimporter/support.go
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
// 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 gcimporter
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"io"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Copy of $GOROOT/src/cmd/internal/archive.ReadHeader.
|
||||
func readArchiveHeader(b *bufio.Reader, name string) int {
|
||||
// architecture-independent object file output
|
||||
const HeaderSize = 60
|
||||
|
||||
var buf [HeaderSize]byte
|
||||
if _, err := io.ReadFull(b, buf[:]); err != nil {
|
||||
return -1
|
||||
}
|
||||
aname := strings.Trim(string(buf[0:16]), " ")
|
||||
if !strings.HasPrefix(aname, name) {
|
||||
return -1
|
||||
}
|
||||
asize := strings.Trim(string(buf[48:58]), " ")
|
||||
i, _ := strconv.Atoi(asize)
|
||||
return i
|
||||
}
|
17
vendor/golang.org/x/tools/internal/gcimporter/ureader_yes.go
generated
vendored
17
vendor/golang.org/x/tools/internal/gcimporter/ureader_yes.go
generated
vendored
@ -11,10 +11,10 @@ import (
|
||||
"go/token"
|
||||
"go/types"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/tools/internal/aliases"
|
||||
"golang.org/x/tools/internal/pkgbits"
|
||||
"golang.org/x/tools/internal/typesinternal"
|
||||
)
|
||||
|
||||
// A pkgReader holds the shared state for reading a unified IR package
|
||||
@ -71,7 +71,6 @@ func UImportData(fset *token.FileSet, imports map[string]*types.Package, data []
|
||||
}
|
||||
|
||||
s := string(data)
|
||||
s = s[:strings.LastIndex(s, "\n$$\n")]
|
||||
input := pkgbits.NewPkgDecoder(path, s)
|
||||
pkg = readUnifiedPackage(fset, nil, imports, input)
|
||||
return
|
||||
@ -266,7 +265,12 @@ func (pr *pkgReader) pkgIdx(idx pkgbits.Index) *types.Package {
|
||||
func (r *reader) doPkg() *types.Package {
|
||||
path := r.String()
|
||||
switch path {
|
||||
case "":
|
||||
// cmd/compile emits path="main" for main packages because
|
||||
// that's the linker symbol prefix it used; but we need
|
||||
// the package's path as it would be reported by go list,
|
||||
// hence "main" below.
|
||||
// See test at go/packages.TestMainPackagePathInModeTypes.
|
||||
case "", "main":
|
||||
path = r.p.PkgPath()
|
||||
case "builtin":
|
||||
return nil // universe
|
||||
@ -569,7 +573,8 @@ func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) {
|
||||
sig := fn.Type().(*types.Signature)
|
||||
|
||||
recv := types.NewVar(fn.Pos(), fn.Pkg(), "", named)
|
||||
methods[i] = types.NewFunc(fn.Pos(), fn.Pkg(), fn.Name(), types.NewSignature(recv, sig.Params(), sig.Results(), sig.Variadic()))
|
||||
typesinternal.SetVarKind(recv, typesinternal.RecvVar)
|
||||
methods[i] = types.NewFunc(fn.Pos(), fn.Pkg(), fn.Name(), types.NewSignatureType(recv, nil, nil, sig.Params(), sig.Results(), sig.Variadic()))
|
||||
}
|
||||
|
||||
embeds := make([]types.Type, iface.NumEmbeddeds())
|
||||
@ -616,7 +621,9 @@ func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) {
|
||||
case pkgbits.ObjVar:
|
||||
pos := r.pos()
|
||||
typ := r.typ()
|
||||
declare(types.NewVar(pos, objPkg, objName, typ))
|
||||
v := types.NewVar(pos, objPkg, objName, typ)
|
||||
typesinternal.SetVarKind(v, typesinternal.PackageVar)
|
||||
declare(v)
|
||||
}
|
||||
}
|
||||
|
||||
|
44
vendor/golang.org/x/tools/internal/gocommand/invoke.go
generated
vendored
44
vendor/golang.org/x/tools/internal/gocommand/invoke.go
generated
vendored
@ -28,7 +28,7 @@ import (
|
||||
"golang.org/x/tools/internal/event/label"
|
||||
)
|
||||
|
||||
// An Runner will run go command invocations and serialize
|
||||
// A Runner will run go command invocations and serialize
|
||||
// them if it sees a concurrency error.
|
||||
type Runner struct {
|
||||
// once guards the runner initialization.
|
||||
@ -141,7 +141,7 @@ func (runner *Runner) runPiped(ctx context.Context, inv Invocation, stdout, stde
|
||||
|
||||
// Wait for all in-progress go commands to return before proceeding,
|
||||
// to avoid load concurrency errors.
|
||||
for i := 0; i < maxInFlight; i++ {
|
||||
for range maxInFlight {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err(), ctx.Err()
|
||||
@ -179,7 +179,7 @@ type Invocation struct {
|
||||
CleanEnv bool
|
||||
Env []string
|
||||
WorkingDir string
|
||||
Logf func(format string, args ...interface{})
|
||||
Logf func(format string, args ...any)
|
||||
}
|
||||
|
||||
// Postcondition: both error results have same nilness.
|
||||
@ -388,7 +388,9 @@ func runCmdContext(ctx context.Context, cmd *exec.Cmd) (err error) {
|
||||
case err := <-resChan:
|
||||
return err
|
||||
case <-timer.C:
|
||||
HandleHangingGoCommand(startTime, cmd)
|
||||
// HandleHangingGoCommand terminates this process.
|
||||
// Pass off resChan in case we can collect the command error.
|
||||
handleHangingGoCommand(startTime, cmd, resChan)
|
||||
case <-ctx.Done():
|
||||
}
|
||||
} else {
|
||||
@ -413,8 +415,6 @@ func runCmdContext(ctx context.Context, cmd *exec.Cmd) (err error) {
|
||||
}
|
||||
|
||||
// Didn't shut down in response to interrupt. Kill it hard.
|
||||
// TODO(rfindley): per advice from bcmills@, it may be better to send SIGQUIT
|
||||
// on certain platforms, such as unix.
|
||||
if err := cmd.Process.Kill(); err != nil && !errors.Is(err, os.ErrProcessDone) && debug {
|
||||
log.Printf("error killing the Go command: %v", err)
|
||||
}
|
||||
@ -422,15 +422,17 @@ func runCmdContext(ctx context.Context, cmd *exec.Cmd) (err error) {
|
||||
return <-resChan
|
||||
}
|
||||
|
||||
func HandleHangingGoCommand(start time.Time, cmd *exec.Cmd) {
|
||||
// handleHangingGoCommand outputs debugging information to help diagnose the
|
||||
// cause of a hanging Go command, and then exits with log.Fatalf.
|
||||
func handleHangingGoCommand(start time.Time, cmd *exec.Cmd, resChan chan error) {
|
||||
switch runtime.GOOS {
|
||||
case "linux", "darwin", "freebsd", "netbsd":
|
||||
case "linux", "darwin", "freebsd", "netbsd", "openbsd":
|
||||
fmt.Fprintln(os.Stderr, `DETECTED A HANGING GO COMMAND
|
||||
|
||||
The gopls test runner has detected a hanging go command. In order to debug
|
||||
this, the output of ps and lsof/fstat is printed below.
|
||||
The gopls test runner has detected a hanging go command. In order to debug
|
||||
this, the output of ps and lsof/fstat is printed below.
|
||||
|
||||
See golang/go#54461 for more details.`)
|
||||
See golang/go#54461 for more details.`)
|
||||
|
||||
fmt.Fprintln(os.Stderr, "\nps axo ppid,pid,command:")
|
||||
fmt.Fprintln(os.Stderr, "-------------------------")
|
||||
@ -438,7 +440,7 @@ See golang/go#54461 for more details.`)
|
||||
psCmd.Stdout = os.Stderr
|
||||
psCmd.Stderr = os.Stderr
|
||||
if err := psCmd.Run(); err != nil {
|
||||
panic(fmt.Sprintf("running ps: %v", err))
|
||||
log.Printf("Handling hanging Go command: running ps: %v", err)
|
||||
}
|
||||
|
||||
listFiles := "lsof"
|
||||
@ -452,10 +454,24 @@ See golang/go#54461 for more details.`)
|
||||
listFilesCmd.Stdout = os.Stderr
|
||||
listFilesCmd.Stderr = os.Stderr
|
||||
if err := listFilesCmd.Run(); err != nil {
|
||||
panic(fmt.Sprintf("running %s: %v", listFiles, err))
|
||||
log.Printf("Handling hanging Go command: running %s: %v", listFiles, err)
|
||||
}
|
||||
// Try to extract information about the slow go process by issuing a SIGQUIT.
|
||||
if err := cmd.Process.Signal(sigStuckProcess); err == nil {
|
||||
select {
|
||||
case err := <-resChan:
|
||||
stderr := "not a bytes.Buffer"
|
||||
if buf, _ := cmd.Stderr.(*bytes.Buffer); buf != nil {
|
||||
stderr = buf.String()
|
||||
}
|
||||
log.Printf("Quit hanging go command:\n\terr:%v\n\tstderr:\n%v\n\n", err, stderr)
|
||||
case <-time.After(5 * time.Second):
|
||||
}
|
||||
} else {
|
||||
log.Printf("Sending signal %d to hanging go command: %v", sigStuckProcess, err)
|
||||
}
|
||||
}
|
||||
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))
|
||||
log.Fatalf("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 {
|
||||
|
13
vendor/golang.org/x/tools/internal/gocommand/invoke_notunix.go
generated
vendored
Normal file
13
vendor/golang.org/x/tools/internal/gocommand/invoke_notunix.go
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright 2025 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 !unix
|
||||
|
||||
package gocommand
|
||||
|
||||
import "os"
|
||||
|
||||
// sigStuckProcess is the signal to send to kill a hanging subprocess.
|
||||
// On Unix we send SIGQUIT, but on non-Unix we only have os.Kill.
|
||||
var sigStuckProcess = os.Kill
|
13
vendor/golang.org/x/tools/internal/gocommand/invoke_unix.go
generated
vendored
Normal file
13
vendor/golang.org/x/tools/internal/gocommand/invoke_unix.go
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright 2025 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 unix
|
||||
|
||||
package gocommand
|
||||
|
||||
import "syscall"
|
||||
|
||||
// Sigstuckprocess is the signal to send to kill a hanging subprocess.
|
||||
// Send SIGQUIT to get a stack trace.
|
||||
var sigStuckProcess = syscall.SIGQUIT
|
8
vendor/golang.org/x/tools/internal/packagesinternal/packages.go
generated
vendored
8
vendor/golang.org/x/tools/internal/packagesinternal/packages.go
generated
vendored
@ -5,8 +5,7 @@
|
||||
// Package packagesinternal exposes internal-only fields from go/packages.
|
||||
package packagesinternal
|
||||
|
||||
var GetForTest = func(p interface{}) string { return "" }
|
||||
var GetDepsErrors = func(p interface{}) []*PackageError { return nil }
|
||||
var GetDepsErrors = func(p any) []*PackageError { return nil }
|
||||
|
||||
type PackageError struct {
|
||||
ImportStack []string // shortest path from package named on command line to this one
|
||||
@ -16,7 +15,6 @@ type PackageError struct {
|
||||
|
||||
var TypecheckCgo int
|
||||
var DepsErrors int // must be set as a LoadMode to call GetDepsErrors
|
||||
var ForTest int // must be set as a LoadMode to call GetForTest
|
||||
|
||||
var SetModFlag = func(config interface{}, value string) {}
|
||||
var SetModFile = func(config interface{}, value string) {}
|
||||
var SetModFlag = func(config any, value string) {}
|
||||
var SetModFile = func(config any, value string) {}
|
||||
|
2
vendor/golang.org/x/tools/internal/pkgbits/decoder.go
generated
vendored
2
vendor/golang.org/x/tools/internal/pkgbits/decoder.go
generated
vendored
@ -259,7 +259,7 @@ func (r *Decoder) rawUvarint() uint64 {
|
||||
func readUvarint(r *strings.Reader) (uint64, error) {
|
||||
var x uint64
|
||||
var s uint
|
||||
for i := 0; i < binary.MaxVarintLen64; i++ {
|
||||
for i := range binary.MaxVarintLen64 {
|
||||
b, err := r.ReadByte()
|
||||
if err != nil {
|
||||
if i > 0 && err == io.EOF {
|
||||
|
359
vendor/golang.org/x/tools/internal/stdlib/deps.go
generated
vendored
Normal file
359
vendor/golang.org/x/tools/internal/stdlib/deps.go
generated
vendored
Normal file
@ -0,0 +1,359 @@
|
||||
// Copyright 2025 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.
|
||||
|
||||
// Code generated by generate.go. DO NOT EDIT.
|
||||
|
||||
package stdlib
|
||||
|
||||
type pkginfo struct {
|
||||
name string
|
||||
deps string // list of indices of dependencies, as varint-encoded deltas
|
||||
}
|
||||
|
||||
var deps = [...]pkginfo{
|
||||
{"archive/tar", "\x03j\x03E6\x01\v\x01\"\x01\x01\x02\x05\n\x02\x01\x02\x02\v"},
|
||||
{"archive/zip", "\x02\x04`\a\x16\x0206\x01*\x05\x01\x11\x03\x02\r\x04"},
|
||||
{"bufio", "\x03j~E\x13"},
|
||||
{"bytes", "m+S\x03\fG\x02\x02"},
|
||||
{"cmp", ""},
|
||||
{"compress/bzip2", "\x02\x02\xe7\x01B"},
|
||||
{"compress/flate", "\x02k\x03{\r\x024\x01\x03"},
|
||||
{"compress/gzip", "\x02\x04`\a\x03\x15fT"},
|
||||
{"compress/lzw", "\x02k\x03{"},
|
||||
{"compress/zlib", "\x02\x04`\a\x03\x13\x01g"},
|
||||
{"container/heap", "\xae\x02"},
|
||||
{"container/list", ""},
|
||||
{"container/ring", ""},
|
||||
{"context", "m\\i\x01\f"},
|
||||
{"crypto", "\x83\x01hD"},
|
||||
{"crypto/aes", "\x10\n\a\x8e\x02"},
|
||||
{"crypto/cipher", "\x03\x1e\x01\x01\x1d\x11\x1c,R"},
|
||||
{"crypto/des", "\x10\x13\x1d-,\x96\x01\x03"},
|
||||
{"crypto/dsa", "@\x04)~\x0e"},
|
||||
{"crypto/ecdh", "\x03\v\f\x0e\x04\x14\x04\r\x1c~"},
|
||||
{"crypto/ecdsa", "\x0e\x05\x03\x04\x01\x0e\x16\x01\x04\f\x01\x1c~\x0e\x04K\x01"},
|
||||
{"crypto/ed25519", "\x0e\x1c\x16\n\a\x1c~D"},
|
||||
{"crypto/elliptic", "0=~\x0e9"},
|
||||
{"crypto/fips140", " \x05\x90\x01"},
|
||||
{"crypto/hkdf", "-\x12\x01-\x16"},
|
||||
{"crypto/hmac", "\x1a\x14\x11\x01\x112"},
|
||||
{"crypto/internal/boring", "\x0e\x02\rf"},
|
||||
{"crypto/internal/boring/bbig", "\x1a\xdf\x01L"},
|
||||
{"crypto/internal/boring/bcache", "\xb3\x02\x12"},
|
||||
{"crypto/internal/boring/sig", ""},
|
||||
{"crypto/internal/cryptotest", "\x03\r\n)\x0e\x19\x06\x13\x12#\a\t\x11\x12\x11\x1a\r\r\x05\n"},
|
||||
{"crypto/internal/entropy", "E"},
|
||||
{"crypto/internal/fips140", ">/~8\r\x15"},
|
||||
{"crypto/internal/fips140/aes", "\x03\x1d\x03\x02\x13\x04\x01\x01\x05*\x8d\x015"},
|
||||
{"crypto/internal/fips140/aes/gcm", " \x01\x02\x02\x02\x11\x04\x01\x06*\x8b\x01"},
|
||||
{"crypto/internal/fips140/alias", "\xc5\x02"},
|
||||
{"crypto/internal/fips140/bigmod", "%\x17\x01\x06*\x8d\x01"},
|
||||
{"crypto/internal/fips140/check", " \x0e\x06\b\x02\xad\x01Z"},
|
||||
{"crypto/internal/fips140/check/checktest", "%\xfe\x01\""},
|
||||
{"crypto/internal/fips140/drbg", "\x03\x1c\x01\x01\x04\x13\x04\b\x01(~\x0f8"},
|
||||
{"crypto/internal/fips140/ecdh", "\x03\x1d\x05\x02\t\f1~\x0f8"},
|
||||
{"crypto/internal/fips140/ecdsa", "\x03\x1d\x04\x01\x02\a\x02\x067~G"},
|
||||
{"crypto/internal/fips140/ed25519", "\x03\x1d\x05\x02\x04\v7\xc2\x01\x03"},
|
||||
{"crypto/internal/fips140/edwards25519", "%\a\f\x041\x8d\x018"},
|
||||
{"crypto/internal/fips140/edwards25519/field", "%\x13\x041\x8d\x01"},
|
||||
{"crypto/internal/fips140/hkdf", "\x03\x1d\x05\t\x069"},
|
||||
{"crypto/internal/fips140/hmac", "\x03\x1d\x14\x01\x017"},
|
||||
{"crypto/internal/fips140/mlkem", "\x03\x1d\x05\x02\x0e\x03\x041"},
|
||||
{"crypto/internal/fips140/nistec", "%\f\a\x041\x8d\x01)\x0f\x13"},
|
||||
{"crypto/internal/fips140/nistec/fiat", "%\x135\x8d\x01"},
|
||||
{"crypto/internal/fips140/pbkdf2", "\x03\x1d\x05\t\x069"},
|
||||
{"crypto/internal/fips140/rsa", "\x03\x1d\x04\x01\x02\r\x01\x01\x025~G"},
|
||||
{"crypto/internal/fips140/sha256", "\x03\x1d\x1c\x01\x06*\x8d\x01"},
|
||||
{"crypto/internal/fips140/sha3", "\x03\x1d\x18\x04\x010\x8d\x01K"},
|
||||
{"crypto/internal/fips140/sha512", "\x03\x1d\x1c\x01\x06*\x8d\x01"},
|
||||
{"crypto/internal/fips140/ssh", " \x05"},
|
||||
{"crypto/internal/fips140/subtle", "#"},
|
||||
{"crypto/internal/fips140/tls12", "\x03\x1d\x05\t\x06\x027"},
|
||||
{"crypto/internal/fips140/tls13", "\x03\x1d\x05\b\a\b1"},
|
||||
{"crypto/internal/fips140deps", ""},
|
||||
{"crypto/internal/fips140deps/byteorder", "\x99\x01"},
|
||||
{"crypto/internal/fips140deps/cpu", "\xad\x01\a"},
|
||||
{"crypto/internal/fips140deps/godebug", "\xb5\x01"},
|
||||
{"crypto/internal/fips140hash", "5\x1a4\xc2\x01"},
|
||||
{"crypto/internal/fips140only", "'\r\x01\x01M26"},
|
||||
{"crypto/internal/fips140test", ""},
|
||||
{"crypto/internal/hpke", "\x0e\x01\x01\x03\x1a\x1d#,aM"},
|
||||
{"crypto/internal/impl", "\xb0\x02"},
|
||||
{"crypto/internal/randutil", "\xeb\x01\x12"},
|
||||
{"crypto/internal/sysrand", "mi\"\x1e\r\x0f\x01\x01\v\x06"},
|
||||
{"crypto/internal/sysrand/internal/seccomp", "m"},
|
||||
{"crypto/md5", "\x0e2-\x16\x16a"},
|
||||
{"crypto/mlkem", "/"},
|
||||
{"crypto/pbkdf2", "2\r\x01-\x16"},
|
||||
{"crypto/rand", "\x1a\x06\a\x19\x04\x01(~\x0eL"},
|
||||
{"crypto/rc4", "#\x1d-\xc2\x01"},
|
||||
{"crypto/rsa", "\x0e\f\x01\t\x0f\f\x01\x04\x06\a\x1c\x03\x1326\r\x01"},
|
||||
{"crypto/sha1", "\x0e\f&-\x16\x16\x14M"},
|
||||
{"crypto/sha256", "\x0e\f\x1aO"},
|
||||
{"crypto/sha3", "\x0e'N\xc2\x01"},
|
||||
{"crypto/sha512", "\x0e\f\x1cM"},
|
||||
{"crypto/subtle", "8\x96\x01U"},
|
||||
{"crypto/tls", "\x03\b\x02\x01\x01\x01\x01\x02\x01\x01\x01\x03\x01\a\x01\v\x02\n\x01\b\x05\x03\x01\x01\x01\x01\x02\x01\x02\x01\x17\x02\x03\x13\x16\x14\b6\x16\x15\r\n\x01\x01\x01\x02\x01\f\x06\x02\x01"},
|
||||
{"crypto/tls/internal/fips140tls", " \x93\x02"},
|
||||
{"crypto/x509", "\x03\v\x01\x01\x01\x01\x01\x01\x01\x011\x03\x02\x01\x01\x02\x05\x0e\x06\x02\x02\x03E\x033\x01\x02\t\x01\x01\x01\a\x0f\x05\x01\x06\x02\x05\f\x01\x02\r\x02\x01\x01\x02\x03\x01"},
|
||||
{"crypto/x509/pkix", "c\x06\a\x89\x01F"},
|
||||
{"database/sql", "\x03\nJ\x16\x03{\f\x06!\x05\n\x02\x03\x01\f\x02\x02\x02"},
|
||||
{"database/sql/driver", "\r`\x03\xae\x01\x11\x10"},
|
||||
{"debug/buildinfo", "\x03W\x02\x01\x01\b\a\x03`\x19\x02\x01*\x0f "},
|
||||
{"debug/dwarf", "\x03c\a\x03{0\x13\x01\x01"},
|
||||
{"debug/elf", "\x03\x06P\r\a\x03`\x1a\x01+\x19\x01\x15"},
|
||||
{"debug/gosym", "\x03c\n\xbe\x01\x01\x01\x02"},
|
||||
{"debug/macho", "\x03\x06P\r\n`\x1b+\x19\x01"},
|
||||
{"debug/pe", "\x03\x06P\r\a\x03`\x1b+\x19\x01\x15"},
|
||||
{"debug/plan9obj", "f\a\x03`\x1b+"},
|
||||
{"embed", "m+:\x19\x01S"},
|
||||
{"embed/internal/embedtest", ""},
|
||||
{"encoding", ""},
|
||||
{"encoding/ascii85", "\xeb\x01D"},
|
||||
{"encoding/asn1", "\x03j\x03\x88\x01\x01%\x0f\x02\x01\x0f\x03\x01"},
|
||||
{"encoding/base32", "\xeb\x01B\x02"},
|
||||
{"encoding/base64", "f\x85\x01B\x02"},
|
||||
{"encoding/binary", "m~\r&\x0f\x05"},
|
||||
{"encoding/csv", "\x02\x01j\x03{E\x11\x02"},
|
||||
{"encoding/gob", "\x02_\x05\a\x03`\x1b\f\x01\x02\x1c\b\x14\x01\x0e\x02"},
|
||||
{"encoding/hex", "m\x03{B\x03"},
|
||||
{"encoding/json", "\x03\x01]\x04\b\x03{\r&\x0f\x02\x01\x02\x0f\x01\x01\x02"},
|
||||
{"encoding/pem", "\x03b\b~B\x03"},
|
||||
{"encoding/xml", "\x02\x01^\f\x03{3\x05\f\x01\x02\x0f\x02"},
|
||||
{"errors", "\xc9\x01|"},
|
||||
{"expvar", "jK:\t\n\x14\r\n\x02\x03\x01\x10"},
|
||||
{"flag", "a\f\x03{+\b\x05\n\x02\x01\x0f"},
|
||||
{"fmt", "mE9\r\x1e\b\x0f\x02\x03\x11"},
|
||||
{"go/ast", "\x03\x01l\x0f\x01k\x03(\b\x0f\x02\x01"},
|
||||
{"go/ast/internal/tests", ""},
|
||||
{"go/build", "\x02\x01j\x03\x01\x03\x02\a\x02\x01\x17\x1e\x04\x02\t\x14\x13\x01*\x01\x04\x01\a\n\x02\x01\x11\x02\x02"},
|
||||
{"go/build/constraint", "m\xc2\x01\x01\x11\x02"},
|
||||
{"go/constant", "p\x10x\x01\x015\x01\x02\x11"},
|
||||
{"go/doc", "\x04l\x01\x06\t=.0\x12\x02\x01\x11\x02"},
|
||||
{"go/doc/comment", "\x03m\xbd\x01\x01\x01\x01\x11\x02"},
|
||||
{"go/format", "\x03m\x01\f\x01\x02kE"},
|
||||
{"go/importer", "s\a\x01\x01\x04\x01j8"},
|
||||
{"go/internal/gccgoimporter", "\x02\x01W\x13\x03\x05\v\x01h\x02+\x01\x05\x13\x01\v\b"},
|
||||
{"go/internal/gcimporter", "\x02n\x10\x01/\x05\x0e(+\x17\x03\x02"},
|
||||
{"go/internal/srcimporter", "p\x01\x02\n\x03\x01j+\x01\x05\x14\x02\x13"},
|
||||
{"go/parser", "\x03j\x03\x01\x03\v\x01k\x01*\x06\x14"},
|
||||
{"go/printer", "p\x01\x03\x03\tk\r\x1e\x17\x02\x01\x02\n\x05\x02"},
|
||||
{"go/scanner", "\x03m\x10k1\x12\x01\x12\x02"},
|
||||
{"go/token", "\x04l\xbd\x01\x02\x03\x01\x0e\x02"},
|
||||
{"go/types", "\x03\x01\x06c\x03\x01\x04\b\x03\x02\x15\x1e\x06,\x04\x03\n$\a\n\x01\x01\x01\x02\x01\x0e\x02\x02"},
|
||||
{"go/version", "\xba\x01v"},
|
||||
{"hash", "\xeb\x01"},
|
||||
{"hash/adler32", "m\x16\x16"},
|
||||
{"hash/crc32", "m\x16\x16\x14\x85\x01\x01\x12"},
|
||||
{"hash/crc64", "m\x16\x16\x99\x01"},
|
||||
{"hash/fnv", "m\x16\x16a"},
|
||||
{"hash/maphash", "\x94\x01\x05\x1b\x03AM"},
|
||||
{"html", "\xb0\x02\x02\x11"},
|
||||
{"html/template", "\x03g\x06\x19,6\x01\v\x1f\x05\x01\x02\x03\x0e\x01\x02\v\x01\x03\x02"},
|
||||
{"image", "\x02k\x1f_\x0f5\x03\x01"},
|
||||
{"image/color", ""},
|
||||
{"image/color/palette", "\x8c\x01"},
|
||||
{"image/draw", "\x8b\x01\x01\x04"},
|
||||
{"image/gif", "\x02\x01\x05e\x03\x1b\x01\x01\x01\vR"},
|
||||
{"image/internal/imageutil", "\x8b\x01"},
|
||||
{"image/jpeg", "\x02k\x1e\x01\x04["},
|
||||
{"image/png", "\x02\a]\n\x13\x02\x06\x01_D"},
|
||||
{"index/suffixarray", "\x03c\a~\r)\f\x01"},
|
||||
{"internal/abi", "\xb4\x01\x91\x01"},
|
||||
{"internal/asan", "\xc5\x02"},
|
||||
{"internal/bisect", "\xa3\x02\x0f\x01"},
|
||||
{"internal/buildcfg", "pG_\x06\x02\x05\f\x01"},
|
||||
{"internal/bytealg", "\xad\x01\x98\x01"},
|
||||
{"internal/byteorder", ""},
|
||||
{"internal/cfg", ""},
|
||||
{"internal/chacha8rand", "\x99\x01\x1b\x91\x01"},
|
||||
{"internal/copyright", ""},
|
||||
{"internal/coverage", ""},
|
||||
{"internal/coverage/calloc", ""},
|
||||
{"internal/coverage/cfile", "j\x06\x17\x16\x01\x02\x01\x01\x01\x01\x01\x01\x01#\x01 +\x06\a\f\x01\x03\f\x06"},
|
||||
{"internal/coverage/cformat", "\x04l-\x04J\f6\x01\x02\f"},
|
||||
{"internal/coverage/cmerge", "p-["},
|
||||
{"internal/coverage/decodecounter", "f\n-\v\x02A+\x19\x16"},
|
||||
{"internal/coverage/decodemeta", "\x02d\n\x17\x16\v\x02A+"},
|
||||
{"internal/coverage/encodecounter", "\x02d\n-\f\x01\x02?\f\x1f\x17"},
|
||||
{"internal/coverage/encodemeta", "\x02\x01c\n\x13\x04\x16\r\x02?+/"},
|
||||
{"internal/coverage/pods", "\x04l-y\x06\x05\f\x02\x01"},
|
||||
{"internal/coverage/rtcov", "\xc5\x02"},
|
||||
{"internal/coverage/slicereader", "f\n{Z"},
|
||||
{"internal/coverage/slicewriter", "p{"},
|
||||
{"internal/coverage/stringtab", "p8\x04?"},
|
||||
{"internal/coverage/test", ""},
|
||||
{"internal/coverage/uleb128", ""},
|
||||
{"internal/cpu", "\xc5\x02"},
|
||||
{"internal/dag", "\x04l\xbd\x01\x03"},
|
||||
{"internal/diff", "\x03m\xbe\x01\x02"},
|
||||
{"internal/exportdata", "\x02\x01j\x03\x03]\x1b+\x01\x05\x13\x01\x02"},
|
||||
{"internal/filepathlite", "m+:\x1aA"},
|
||||
{"internal/fmtsort", "\x04\x9a\x02\x0f"},
|
||||
{"internal/fuzz", "\x03\nA\x18\x04\x03\x03\x01\f\x0356\r\x02\x1c\x01\x05\x02\x05\f\x01\x02\x01\x01\v\x04\x02"},
|
||||
{"internal/goarch", ""},
|
||||
{"internal/godebug", "\x96\x01 |\x01\x12"},
|
||||
{"internal/godebugs", ""},
|
||||
{"internal/goexperiment", ""},
|
||||
{"internal/goos", ""},
|
||||
{"internal/goroot", "\x96\x02\x01\x05\x14\x02"},
|
||||
{"internal/gover", "\x04"},
|
||||
{"internal/goversion", ""},
|
||||
{"internal/itoa", ""},
|
||||
{"internal/lazyregexp", "\x96\x02\v\x0f\x02"},
|
||||
{"internal/lazytemplate", "\xeb\x01+\x1a\x02\v"},
|
||||
{"internal/msan", "\xc5\x02"},
|
||||
{"internal/nettrace", ""},
|
||||
{"internal/obscuretestdata", "e\x86\x01+"},
|
||||
{"internal/oserror", "m"},
|
||||
{"internal/pkgbits", "\x03K\x18\a\x03\x05\vk\x0e\x1d\r\f\x01"},
|
||||
{"internal/platform", ""},
|
||||
{"internal/poll", "mO\x1a\x158\x0f\x01\x01\v\x06"},
|
||||
{"internal/profile", "\x03\x04f\x03{6\r\x01\x01\x0f"},
|
||||
{"internal/profilerecord", ""},
|
||||
{"internal/race", "\x94\x01\xb1\x01"},
|
||||
{"internal/reflectlite", "\x94\x01 4;\""},
|
||||
{"internal/runtime/atomic", "\xc5\x02"},
|
||||
{"internal/runtime/exithook", "\xca\x01{"},
|
||||
{"internal/runtime/maps", "\x94\x01\x01\x1f\v\t\x05\x01w"},
|
||||
{"internal/runtime/math", "\xb4\x01"},
|
||||
{"internal/runtime/sys", "\xb4\x01\x04"},
|
||||
{"internal/runtime/syscall", "\xc5\x02"},
|
||||
{"internal/saferio", "\xeb\x01Z"},
|
||||
{"internal/singleflight", "\xb2\x02"},
|
||||
{"internal/stringslite", "\x98\x01\xad\x01"},
|
||||
{"internal/sync", "\x94\x01 \x14k\x12"},
|
||||
{"internal/synctest", "\xc5\x02"},
|
||||
{"internal/syscall/execenv", "\xb4\x02"},
|
||||
{"internal/syscall/unix", "\xa3\x02\x10\x01\x11"},
|
||||
{"internal/sysinfo", "\x02\x01\xaa\x01>+\x1a\x02"},
|
||||
{"internal/syslist", ""},
|
||||
{"internal/testenv", "\x03\n`\x02\x01*\x1a\x10(*\x01\x05\a\f\x01\x02\x02\x01\n"},
|
||||
{"internal/testlog", "\xb2\x02\x01\x12"},
|
||||
{"internal/testpty", "m\x03\xa6\x01"},
|
||||
{"internal/trace", "\x02\x01\x01\x06\\\a\x03m\x01\x01\x06\x06\x03\n5\x01\x02\x0f"},
|
||||
{"internal/trace/event", ""},
|
||||
{"internal/trace/event/go122", "pm"},
|
||||
{"internal/trace/internal/oldtrace", "\x03\x01b\a\x03m\b\x06\r5\x01"},
|
||||
{"internal/trace/internal/testgen/go122", "\x03c\nl\x01\x01\x03\x04\x010\v\x0f"},
|
||||
{"internal/trace/raw", "\x02d\nm\b\x06D\x01\x11"},
|
||||
{"internal/trace/testtrace", "\x02\x01j\x03l\x05\x05\x056\f\x02\x01"},
|
||||
{"internal/trace/traceviewer", "\x02]\v\x06\x1a<\x16\b\a\x04\t\n\x14\x01\x05\a\f\x01\x02\r"},
|
||||
{"internal/trace/traceviewer/format", ""},
|
||||
{"internal/trace/version", "pm\x01\r"},
|
||||
{"internal/txtar", "\x03m\xa6\x01\x1a"},
|
||||
{"internal/types/errors", "\xaf\x02"},
|
||||
{"internal/unsafeheader", "\xc5\x02"},
|
||||
{"internal/xcoff", "Y\r\a\x03`\x1b+\x19\x01"},
|
||||
{"internal/zstd", "f\a\x03{\x0f"},
|
||||
{"io", "m\xc5\x01"},
|
||||
{"io/fs", "m+*)0\x12\x12\x04"},
|
||||
{"io/ioutil", "\xeb\x01\x01*\x17\x03"},
|
||||
{"iter", "\xc8\x01[\""},
|
||||
{"log", "p{\x05&\r\x0f\x01\f"},
|
||||
{"log/internal", ""},
|
||||
{"log/slog", "\x03\nT\t\x03\x03{\x04\x01\x02\x02\x04&\x05\n\x02\x01\x02\x01\f\x02\x02\x02"},
|
||||
{"log/slog/internal", ""},
|
||||
{"log/slog/internal/benchmarks", "\r`\x03{\x06\x03;\x10"},
|
||||
{"log/slog/internal/buffer", "\xb2\x02"},
|
||||
{"log/slog/internal/slogtest", "\xf1\x01"},
|
||||
{"log/syslog", "m\x03\x7f\x12\x15\x1a\x02\r"},
|
||||
{"maps", "\xee\x01W"},
|
||||
{"math", "\xad\x01MK"},
|
||||
{"math/big", "\x03j\x03)\x14>\r\x02\x023\x01\x02\x13"},
|
||||
{"math/bits", "\xc5\x02"},
|
||||
{"math/cmplx", "\xf8\x01\x02"},
|
||||
{"math/rand", "\xb5\x01C:\x01\x12"},
|
||||
{"math/rand/v2", "m,\x02]\x02K"},
|
||||
{"mime", "\x02\x01b\b\x03{\f\x1f\x17\x03\x02\x0f\x02"},
|
||||
{"mime/multipart", "\x02\x01G#\x03E6\f\x01\x06\x02\x14\x02\x06\x11\x02\x01\x15"},
|
||||
{"mime/quotedprintable", "\x02\x01m{"},
|
||||
{"net", "\x04\t`+\x1d\a\x04\x05\f\x01\x04\x15\x01$\x06\r\n\x05\x01\x01\v\x06\a"},
|
||||
{"net/http", "\x02\x01\x04\x04\x02=\b\x13\x01\a\x03E6\x01\x03\b\x01\x02\x02\x02\x01\x02\x06\x02\x01\n\x01\x01\x05\x01\x02\x05\n\x01\x01\x01\x02\x01\f\x02\x02\x02\b\x01\x01\x01"},
|
||||
{"net/http/cgi", "\x02P\x1b\x03{\x04\b\n\x01\x12\x01\x01\x01\x04\x01\x05\x02\n\x02\x01\x0f\x0e"},
|
||||
{"net/http/cookiejar", "\x04i\x03\x91\x01\x01\b\v\x18\x03\x02\r\x04"},
|
||||
{"net/http/fcgi", "\x02\x01\nY\a\x03{\x16\x01\x01\x13\x1a\x02\r"},
|
||||
{"net/http/httptest", "\x02\x01\nE\x02\x1b\x01{\x04\x12\x01\t\t\x02\x19\x01\x02\r\x0e"},
|
||||
{"net/http/httptrace", "\rEnA\x13\n!"},
|
||||
{"net/http/httputil", "\x02\x01\n`\x03{\x04\x0f\x03\x01\x05\x02\x01\n\x01\x1b\x02\r\x0e"},
|
||||
{"net/http/internal", "\x02\x01j\x03{"},
|
||||
{"net/http/internal/ascii", "\xb0\x02\x11"},
|
||||
{"net/http/internal/testcert", "\xb0\x02"},
|
||||
{"net/http/pprof", "\x02\x01\nc\x19,\x11%\x04\x13\x13\x01\r\x06\x03\x01\x02\x01\x0f"},
|
||||
{"net/internal/cgotest", ""},
|
||||
{"net/internal/socktest", "p\xc2\x01\x02"},
|
||||
{"net/mail", "\x02k\x03{\x04\x0f\x03\x13\x1c\x02\r\x04"},
|
||||
{"net/netip", "\x04i+\x01#<\x025\x15"},
|
||||
{"net/rpc", "\x02f\x05\x03\x10\na\x04\x12\x01\x1c\x0f\x03\x02"},
|
||||
{"net/rpc/jsonrpc", "j\x03\x03{\x16\x10!"},
|
||||
{"net/smtp", "\x19.\v\x13\b\x03{\x16\x13\x1c"},
|
||||
{"net/textproto", "\x02\x01j\x03{\r\t.\x01\x02\x13"},
|
||||
{"net/url", "m\x03\x87\x01$\x12\x02\x01\x15"},
|
||||
{"os", "m+\x01\x18\x03\b\t\r\x03\x01\x04\x11\x017\n\x05\x01\x01\v\x06"},
|
||||
{"os/exec", "\x03\n`H \x01\x15\x01*\x06\a\f\x01\x04\v"},
|
||||
{"os/exec/internal/fdtest", "\xb4\x02"},
|
||||
{"os/signal", "\r\x89\x02\x17\x05\x02"},
|
||||
{"os/user", "\x02\x01j\x03{+\r\f\x01\x02"},
|
||||
{"path", "m+\xab\x01"},
|
||||
{"path/filepath", "m+\x19;*\r\n\x03\x04\x0f"},
|
||||
{"plugin", "m"},
|
||||
{"reflect", "m'\x04\x1c\b\f\x04\x02\x1a\x06\n+\f\x03\x0f\x02\x02"},
|
||||
{"reflect/internal/example1", ""},
|
||||
{"reflect/internal/example2", ""},
|
||||
{"regexp", "\x03\xe8\x017\v\x02\x01\x02\x0f\x02"},
|
||||
{"regexp/syntax", "\xad\x02\x01\x01\x01\x11\x02"},
|
||||
{"runtime", "\x94\x01\x04\x01\x02\f\x06\a\x02\x01\x01\x0f\x03\x01\x01\x01\x01\x01\x03s"},
|
||||
{"runtime/coverage", "\x9f\x01L"},
|
||||
{"runtime/debug", "pUQ\r\n\x02\x01\x0f\x06"},
|
||||
{"runtime/internal/startlinetest", ""},
|
||||
{"runtime/internal/wasitest", ""},
|
||||
{"runtime/metrics", "\xb6\x01B+\""},
|
||||
{"runtime/pprof", "\x02\x01\x01\x03\x06Y\a\x03$3$\r\x1e\r\n\x01\x01\x01\x02\x02\b\x03\x06"},
|
||||
{"runtime/race", "\xab\x02"},
|
||||
{"runtime/race/internal/amd64v1", ""},
|
||||
{"runtime/trace", "\rc{8\x0f\x01\x12"},
|
||||
{"slices", "\x04\xea\x01\fK"},
|
||||
{"sort", "\xc9\x0113"},
|
||||
{"strconv", "m+:&\x02I"},
|
||||
{"strings", "m'\x04:\x19\x03\f8\x0f\x02\x02"},
|
||||
{"structs", ""},
|
||||
{"sync", "\xc8\x01\vP\x10\x12"},
|
||||
{"sync/atomic", "\xc5\x02"},
|
||||
{"syscall", "m(\x03\x01\x1b\b\x03\x03\x06\aT\x0f\x01\x12"},
|
||||
{"testing", "\x03\n`\x02\x01G\x11\x0f\x14\r\x04\x1a\x06\x02\x05\x02\a\x01\x02\x01\x02\x01\f\x02\x02\x02"},
|
||||
{"testing/fstest", "m\x03{\x01\v$\x12\x03\b\a"},
|
||||
{"testing/internal/testdeps", "\x02\v\xa6\x01'\x11+\x03\x05\x03\b\a\x02\r"},
|
||||
{"testing/iotest", "\x03j\x03{\x04"},
|
||||
{"testing/quick", "o\x01\x88\x01\x04\"\x12\x0f"},
|
||||
{"testing/slogtest", "\r`\x03\x81\x01-\x05\x12\n"},
|
||||
{"text/scanner", "\x03m{++\x02"},
|
||||
{"text/tabwriter", "p{X"},
|
||||
{"text/template", "m\x03B9\x01\v\x1e\x01\x05\x01\x02\x05\r\x02\f\x03\x02"},
|
||||
{"text/template/parse", "\x03m\xb3\x01\f\x01\x11\x02"},
|
||||
{"time", "m+\x1d\x1d()\x0f\x02\x11"},
|
||||
{"time/tzdata", "m\xc7\x01\x11"},
|
||||
{"unicode", ""},
|
||||
{"unicode/utf16", ""},
|
||||
{"unicode/utf8", ""},
|
||||
{"unique", "\x94\x01>\x01P\x0f\x13\x12"},
|
||||
{"unsafe", ""},
|
||||
{"vendor/golang.org/x/crypto/chacha20", "\x10V\a\x8d\x01)'"},
|
||||
{"vendor/golang.org/x/crypto/chacha20poly1305", "\x10V\a\xd9\x01\x04\x01\a"},
|
||||
{"vendor/golang.org/x/crypto/cryptobyte", "c\n\x03\x89\x01%!\n"},
|
||||
{"vendor/golang.org/x/crypto/cryptobyte/asn1", ""},
|
||||
{"vendor/golang.org/x/crypto/internal/alias", "\xc5\x02"},
|
||||
{"vendor/golang.org/x/crypto/internal/poly1305", "Q\x15\x94\x01"},
|
||||
{"vendor/golang.org/x/net/dns/dnsmessage", "m"},
|
||||
{"vendor/golang.org/x/net/http/httpguts", "\x81\x02\x13\x1c\x13\r"},
|
||||
{"vendor/golang.org/x/net/http/httpproxy", "m\x03\x91\x01\x0f\x05\x01\x1a\x13\r"},
|
||||
{"vendor/golang.org/x/net/http2/hpack", "\x03j\x03{G"},
|
||||
{"vendor/golang.org/x/net/idna", "p\x88\x018\x13\x10\x02\x01"},
|
||||
{"vendor/golang.org/x/net/nettest", "\x03c\a\x03{\x11\x05\x15\x01\f\f\x01\x02\x02\x01\n"},
|
||||
{"vendor/golang.org/x/sys/cpu", "\x96\x02\r\f\x01\x15"},
|
||||
{"vendor/golang.org/x/text/secure/bidirule", "m\xd6\x01\x11\x01"},
|
||||
{"vendor/golang.org/x/text/transform", "\x03j~X"},
|
||||
{"vendor/golang.org/x/text/unicode/bidi", "\x03\be\x7f?\x15"},
|
||||
{"vendor/golang.org/x/text/unicode/norm", "f\n{G\x11\x11"},
|
||||
{"weak", "\x94\x01\x8f\x01\""},
|
||||
}
|
89
vendor/golang.org/x/tools/internal/stdlib/import.go
generated
vendored
Normal file
89
vendor/golang.org/x/tools/internal/stdlib/import.go
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
// Copyright 2025 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 stdlib
|
||||
|
||||
// This file provides the API for the import graph of the standard library.
|
||||
//
|
||||
// Be aware that the compiler-generated code for every package
|
||||
// implicitly depends on package "runtime" and a handful of others
|
||||
// (see runtimePkgs in GOROOT/src/cmd/internal/objabi/pkgspecial.go).
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"iter"
|
||||
"slices"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Imports returns the sequence of packages directly imported by the
|
||||
// named standard packages, in name order.
|
||||
// The imports of an unknown package are the empty set.
|
||||
//
|
||||
// The graph is built into the application and may differ from the
|
||||
// graph in the Go source tree being analyzed by the application.
|
||||
func Imports(pkgs ...string) iter.Seq[string] {
|
||||
return func(yield func(string) bool) {
|
||||
for _, pkg := range pkgs {
|
||||
if i, ok := find(pkg); ok {
|
||||
var depIndex uint64
|
||||
for data := []byte(deps[i].deps); len(data) > 0; {
|
||||
delta, n := binary.Uvarint(data)
|
||||
depIndex += delta
|
||||
if !yield(deps[depIndex].name) {
|
||||
return
|
||||
}
|
||||
data = data[n:]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dependencies returns the set of all dependencies of the named
|
||||
// standard packages, including the initial package,
|
||||
// in a deterministic topological order.
|
||||
// The dependencies of an unknown package are the empty set.
|
||||
//
|
||||
// The graph is built into the application and may differ from the
|
||||
// graph in the Go source tree being analyzed by the application.
|
||||
func Dependencies(pkgs ...string) iter.Seq[string] {
|
||||
return func(yield func(string) bool) {
|
||||
for _, pkg := range pkgs {
|
||||
if i, ok := find(pkg); ok {
|
||||
var seen [1 + len(deps)/8]byte // bit set of seen packages
|
||||
var visit func(i int) bool
|
||||
visit = func(i int) bool {
|
||||
bit := byte(1) << (i % 8)
|
||||
if seen[i/8]&bit == 0 {
|
||||
seen[i/8] |= bit
|
||||
var depIndex uint64
|
||||
for data := []byte(deps[i].deps); len(data) > 0; {
|
||||
delta, n := binary.Uvarint(data)
|
||||
depIndex += delta
|
||||
if !visit(int(depIndex)) {
|
||||
return false
|
||||
}
|
||||
data = data[n:]
|
||||
}
|
||||
if !yield(deps[i].name) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
if !visit(i) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// find returns the index of pkg in the deps table.
|
||||
func find(pkg string) (int, bool) {
|
||||
return slices.BinarySearchFunc(deps[:], pkg, func(p pkginfo, n string) int {
|
||||
return strings.Compare(p.name, n)
|
||||
})
|
||||
}
|
218
vendor/golang.org/x/tools/internal/stdlib/manifest.go
generated
vendored
218
vendor/golang.org/x/tools/internal/stdlib/manifest.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 The Go Authors. All rights reserved.
|
||||
// Copyright 2025 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.
|
||||
|
||||
@ -268,6 +268,8 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"ErrTooLarge", Var, 0},
|
||||
{"Fields", Func, 0},
|
||||
{"FieldsFunc", Func, 0},
|
||||
{"FieldsFuncSeq", Func, 24},
|
||||
{"FieldsSeq", Func, 24},
|
||||
{"HasPrefix", Func, 0},
|
||||
{"HasSuffix", Func, 0},
|
||||
{"Index", Func, 0},
|
||||
@ -280,6 +282,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"LastIndexAny", Func, 0},
|
||||
{"LastIndexByte", Func, 5},
|
||||
{"LastIndexFunc", Func, 0},
|
||||
{"Lines", Func, 24},
|
||||
{"Map", Func, 0},
|
||||
{"MinRead", Const, 0},
|
||||
{"NewBuffer", Func, 0},
|
||||
@ -293,7 +296,9 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Split", Func, 0},
|
||||
{"SplitAfter", Func, 0},
|
||||
{"SplitAfterN", Func, 0},
|
||||
{"SplitAfterSeq", Func, 24},
|
||||
{"SplitN", Func, 0},
|
||||
{"SplitSeq", Func, 24},
|
||||
{"Title", Func, 0},
|
||||
{"ToLower", Func, 0},
|
||||
{"ToLowerSpecial", Func, 0},
|
||||
@ -535,6 +540,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"NewCTR", Func, 0},
|
||||
{"NewGCM", Func, 2},
|
||||
{"NewGCMWithNonceSize", Func, 5},
|
||||
{"NewGCMWithRandomNonce", Func, 24},
|
||||
{"NewGCMWithTagSize", Func, 11},
|
||||
{"NewOFB", Func, 0},
|
||||
{"Stream", Type, 0},
|
||||
@ -673,6 +679,14 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Unmarshal", Func, 0},
|
||||
{"UnmarshalCompressed", Func, 15},
|
||||
},
|
||||
"crypto/fips140": {
|
||||
{"Enabled", Func, 24},
|
||||
},
|
||||
"crypto/hkdf": {
|
||||
{"Expand", Func, 24},
|
||||
{"Extract", Func, 24},
|
||||
{"Key", Func, 24},
|
||||
},
|
||||
"crypto/hmac": {
|
||||
{"Equal", Func, 1},
|
||||
{"New", Func, 0},
|
||||
@ -683,11 +697,43 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Size", Const, 0},
|
||||
{"Sum", Func, 2},
|
||||
},
|
||||
"crypto/mlkem": {
|
||||
{"(*DecapsulationKey1024).Bytes", Method, 24},
|
||||
{"(*DecapsulationKey1024).Decapsulate", Method, 24},
|
||||
{"(*DecapsulationKey1024).EncapsulationKey", Method, 24},
|
||||
{"(*DecapsulationKey768).Bytes", Method, 24},
|
||||
{"(*DecapsulationKey768).Decapsulate", Method, 24},
|
||||
{"(*DecapsulationKey768).EncapsulationKey", Method, 24},
|
||||
{"(*EncapsulationKey1024).Bytes", Method, 24},
|
||||
{"(*EncapsulationKey1024).Encapsulate", Method, 24},
|
||||
{"(*EncapsulationKey768).Bytes", Method, 24},
|
||||
{"(*EncapsulationKey768).Encapsulate", Method, 24},
|
||||
{"CiphertextSize1024", Const, 24},
|
||||
{"CiphertextSize768", Const, 24},
|
||||
{"DecapsulationKey1024", Type, 24},
|
||||
{"DecapsulationKey768", Type, 24},
|
||||
{"EncapsulationKey1024", Type, 24},
|
||||
{"EncapsulationKey768", Type, 24},
|
||||
{"EncapsulationKeySize1024", Const, 24},
|
||||
{"EncapsulationKeySize768", Const, 24},
|
||||
{"GenerateKey1024", Func, 24},
|
||||
{"GenerateKey768", Func, 24},
|
||||
{"NewDecapsulationKey1024", Func, 24},
|
||||
{"NewDecapsulationKey768", Func, 24},
|
||||
{"NewEncapsulationKey1024", Func, 24},
|
||||
{"NewEncapsulationKey768", Func, 24},
|
||||
{"SeedSize", Const, 24},
|
||||
{"SharedKeySize", Const, 24},
|
||||
},
|
||||
"crypto/pbkdf2": {
|
||||
{"Key", Func, 24},
|
||||
},
|
||||
"crypto/rand": {
|
||||
{"Int", Func, 0},
|
||||
{"Prime", Func, 0},
|
||||
{"Read", Func, 0},
|
||||
{"Reader", Var, 0},
|
||||
{"Text", Func, 24},
|
||||
},
|
||||
"crypto/rc4": {
|
||||
{"(*Cipher).Reset", Method, 0},
|
||||
@ -766,6 +812,39 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Sum224", Func, 2},
|
||||
{"Sum256", Func, 2},
|
||||
},
|
||||
"crypto/sha3": {
|
||||
{"(*SHA3).AppendBinary", Method, 24},
|
||||
{"(*SHA3).BlockSize", Method, 24},
|
||||
{"(*SHA3).MarshalBinary", Method, 24},
|
||||
{"(*SHA3).Reset", Method, 24},
|
||||
{"(*SHA3).Size", Method, 24},
|
||||
{"(*SHA3).Sum", Method, 24},
|
||||
{"(*SHA3).UnmarshalBinary", Method, 24},
|
||||
{"(*SHA3).Write", Method, 24},
|
||||
{"(*SHAKE).AppendBinary", Method, 24},
|
||||
{"(*SHAKE).BlockSize", Method, 24},
|
||||
{"(*SHAKE).MarshalBinary", Method, 24},
|
||||
{"(*SHAKE).Read", Method, 24},
|
||||
{"(*SHAKE).Reset", Method, 24},
|
||||
{"(*SHAKE).UnmarshalBinary", Method, 24},
|
||||
{"(*SHAKE).Write", Method, 24},
|
||||
{"New224", Func, 24},
|
||||
{"New256", Func, 24},
|
||||
{"New384", Func, 24},
|
||||
{"New512", Func, 24},
|
||||
{"NewCSHAKE128", Func, 24},
|
||||
{"NewCSHAKE256", Func, 24},
|
||||
{"NewSHAKE128", Func, 24},
|
||||
{"NewSHAKE256", Func, 24},
|
||||
{"SHA3", Type, 24},
|
||||
{"SHAKE", Type, 24},
|
||||
{"Sum224", Func, 24},
|
||||
{"Sum256", Func, 24},
|
||||
{"Sum384", Func, 24},
|
||||
{"Sum512", Func, 24},
|
||||
{"SumSHAKE128", Func, 24},
|
||||
{"SumSHAKE256", Func, 24},
|
||||
},
|
||||
"crypto/sha512": {
|
||||
{"BlockSize", Const, 0},
|
||||
{"New", Func, 0},
|
||||
@ -788,6 +867,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"ConstantTimeEq", Func, 0},
|
||||
{"ConstantTimeLessOrEq", Func, 2},
|
||||
{"ConstantTimeSelect", Func, 0},
|
||||
{"WithDataIndependentTiming", Func, 24},
|
||||
{"XORBytes", Func, 20},
|
||||
},
|
||||
"crypto/tls": {
|
||||
@ -864,6 +944,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"ClientHelloInfo", Type, 4},
|
||||
{"ClientHelloInfo.CipherSuites", Field, 4},
|
||||
{"ClientHelloInfo.Conn", Field, 8},
|
||||
{"ClientHelloInfo.Extensions", Field, 24},
|
||||
{"ClientHelloInfo.ServerName", Field, 4},
|
||||
{"ClientHelloInfo.SignatureSchemes", Field, 8},
|
||||
{"ClientHelloInfo.SupportedCurves", Field, 4},
|
||||
@ -881,6 +962,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Config.CurvePreferences", Field, 3},
|
||||
{"Config.DynamicRecordSizingDisabled", Field, 7},
|
||||
{"Config.EncryptedClientHelloConfigList", Field, 23},
|
||||
{"Config.EncryptedClientHelloKeys", Field, 24},
|
||||
{"Config.EncryptedClientHelloRejectionVerify", Field, 23},
|
||||
{"Config.GetCertificate", Field, 4},
|
||||
{"Config.GetClientCertificate", Field, 8},
|
||||
@ -934,6 +1016,10 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"ECHRejectionError", Type, 23},
|
||||
{"ECHRejectionError.RetryConfigList", Field, 23},
|
||||
{"Ed25519", Const, 13},
|
||||
{"EncryptedClientHelloKey", Type, 24},
|
||||
{"EncryptedClientHelloKey.Config", Field, 24},
|
||||
{"EncryptedClientHelloKey.PrivateKey", Field, 24},
|
||||
{"EncryptedClientHelloKey.SendAsRetry", Field, 24},
|
||||
{"InsecureCipherSuites", Func, 14},
|
||||
{"Listen", Func, 0},
|
||||
{"LoadX509KeyPair", Func, 0},
|
||||
@ -1032,6 +1118,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"VersionTLS12", Const, 2},
|
||||
{"VersionTLS13", Const, 12},
|
||||
{"X25519", Const, 8},
|
||||
{"X25519MLKEM768", Const, 24},
|
||||
{"X509KeyPair", Func, 0},
|
||||
},
|
||||
"crypto/x509": {
|
||||
@ -1056,6 +1143,8 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(ConstraintViolationError).Error", Method, 0},
|
||||
{"(HostnameError).Error", Method, 0},
|
||||
{"(InsecureAlgorithmError).Error", Method, 6},
|
||||
{"(OID).AppendBinary", Method, 24},
|
||||
{"(OID).AppendText", Method, 24},
|
||||
{"(OID).Equal", Method, 22},
|
||||
{"(OID).EqualASN1OID", Method, 22},
|
||||
{"(OID).MarshalBinary", Method, 23},
|
||||
@ -1084,6 +1173,10 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Certificate.Extensions", Field, 2},
|
||||
{"Certificate.ExtraExtensions", Field, 2},
|
||||
{"Certificate.IPAddresses", Field, 1},
|
||||
{"Certificate.InhibitAnyPolicy", Field, 24},
|
||||
{"Certificate.InhibitAnyPolicyZero", Field, 24},
|
||||
{"Certificate.InhibitPolicyMapping", Field, 24},
|
||||
{"Certificate.InhibitPolicyMappingZero", Field, 24},
|
||||
{"Certificate.IsCA", Field, 0},
|
||||
{"Certificate.Issuer", Field, 0},
|
||||
{"Certificate.IssuingCertificateURL", Field, 2},
|
||||
@ -1100,6 +1193,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Certificate.PermittedURIDomains", Field, 10},
|
||||
{"Certificate.Policies", Field, 22},
|
||||
{"Certificate.PolicyIdentifiers", Field, 0},
|
||||
{"Certificate.PolicyMappings", Field, 24},
|
||||
{"Certificate.PublicKey", Field, 0},
|
||||
{"Certificate.PublicKeyAlgorithm", Field, 0},
|
||||
{"Certificate.Raw", Field, 0},
|
||||
@ -1107,6 +1201,8 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Certificate.RawSubject", Field, 0},
|
||||
{"Certificate.RawSubjectPublicKeyInfo", Field, 0},
|
||||
{"Certificate.RawTBSCertificate", Field, 0},
|
||||
{"Certificate.RequireExplicitPolicy", Field, 24},
|
||||
{"Certificate.RequireExplicitPolicyZero", Field, 24},
|
||||
{"Certificate.SerialNumber", Field, 0},
|
||||
{"Certificate.Signature", Field, 0},
|
||||
{"Certificate.SignatureAlgorithm", Field, 0},
|
||||
@ -1198,6 +1294,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"NameConstraintsWithoutSANs", Const, 10},
|
||||
{"NameMismatch", Const, 8},
|
||||
{"NewCertPool", Func, 0},
|
||||
{"NoValidChains", Const, 24},
|
||||
{"NotAuthorizedToSign", Const, 0},
|
||||
{"OID", Type, 22},
|
||||
{"OIDFromInts", Func, 22},
|
||||
@ -1219,6 +1316,9 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"ParsePKCS8PrivateKey", Func, 0},
|
||||
{"ParsePKIXPublicKey", Func, 0},
|
||||
{"ParseRevocationList", Func, 19},
|
||||
{"PolicyMapping", Type, 24},
|
||||
{"PolicyMapping.IssuerDomainPolicy", Field, 24},
|
||||
{"PolicyMapping.SubjectDomainPolicy", Field, 24},
|
||||
{"PublicKeyAlgorithm", Type, 0},
|
||||
{"PureEd25519", Const, 13},
|
||||
{"RSA", Const, 0},
|
||||
@ -1265,6 +1365,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"UnknownPublicKeyAlgorithm", Const, 0},
|
||||
{"UnknownSignatureAlgorithm", Const, 0},
|
||||
{"VerifyOptions", Type, 0},
|
||||
{"VerifyOptions.CertificatePolicies", Field, 24},
|
||||
{"VerifyOptions.CurrentTime", Field, 0},
|
||||
{"VerifyOptions.DNSName", Field, 0},
|
||||
{"VerifyOptions.Intermediates", Field, 0},
|
||||
@ -1975,6 +2076,8 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*File).DynString", Method, 1},
|
||||
{"(*File).DynValue", Method, 21},
|
||||
{"(*File).DynamicSymbols", Method, 4},
|
||||
{"(*File).DynamicVersionNeeds", Method, 24},
|
||||
{"(*File).DynamicVersions", Method, 24},
|
||||
{"(*File).ImportedLibraries", Method, 0},
|
||||
{"(*File).ImportedSymbols", Method, 0},
|
||||
{"(*File).Section", Method, 0},
|
||||
@ -2048,6 +2151,8 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(Type).String", Method, 0},
|
||||
{"(Version).GoString", Method, 0},
|
||||
{"(Version).String", Method, 0},
|
||||
{"(VersionIndex).Index", Method, 24},
|
||||
{"(VersionIndex).IsHidden", Method, 24},
|
||||
{"ARM_MAGIC_TRAMP_NUMBER", Const, 0},
|
||||
{"COMPRESS_HIOS", Const, 6},
|
||||
{"COMPRESS_HIPROC", Const, 6},
|
||||
@ -2240,6 +2345,19 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"DynFlag", Type, 0},
|
||||
{"DynFlag1", Type, 21},
|
||||
{"DynTag", Type, 0},
|
||||
{"DynamicVersion", Type, 24},
|
||||
{"DynamicVersion.Deps", Field, 24},
|
||||
{"DynamicVersion.Flags", Field, 24},
|
||||
{"DynamicVersion.Index", Field, 24},
|
||||
{"DynamicVersion.Name", Field, 24},
|
||||
{"DynamicVersionDep", Type, 24},
|
||||
{"DynamicVersionDep.Dep", Field, 24},
|
||||
{"DynamicVersionDep.Flags", Field, 24},
|
||||
{"DynamicVersionDep.Index", Field, 24},
|
||||
{"DynamicVersionFlag", Type, 24},
|
||||
{"DynamicVersionNeed", Type, 24},
|
||||
{"DynamicVersionNeed.Name", Field, 24},
|
||||
{"DynamicVersionNeed.Needs", Field, 24},
|
||||
{"EI_ABIVERSION", Const, 0},
|
||||
{"EI_CLASS", Const, 0},
|
||||
{"EI_DATA", Const, 0},
|
||||
@ -3718,6 +3836,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"SymType", Type, 0},
|
||||
{"SymVis", Type, 0},
|
||||
{"Symbol", Type, 0},
|
||||
{"Symbol.HasVersion", Field, 24},
|
||||
{"Symbol.Info", Field, 0},
|
||||
{"Symbol.Library", Field, 13},
|
||||
{"Symbol.Name", Field, 0},
|
||||
@ -3726,8 +3845,13 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Symbol.Size", Field, 0},
|
||||
{"Symbol.Value", Field, 0},
|
||||
{"Symbol.Version", Field, 13},
|
||||
{"Symbol.VersionIndex", Field, 24},
|
||||
{"Type", Type, 0},
|
||||
{"VER_FLG_BASE", Const, 24},
|
||||
{"VER_FLG_INFO", Const, 24},
|
||||
{"VER_FLG_WEAK", Const, 24},
|
||||
{"Version", Type, 0},
|
||||
{"VersionIndex", Type, 24},
|
||||
},
|
||||
"debug/gosym": {
|
||||
{"(*DecodingError).Error", Method, 0},
|
||||
@ -4453,8 +4577,10 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"FS", Type, 16},
|
||||
},
|
||||
"encoding": {
|
||||
{"BinaryAppender", Type, 24},
|
||||
{"BinaryMarshaler", Type, 2},
|
||||
{"BinaryUnmarshaler", Type, 2},
|
||||
{"TextAppender", Type, 24},
|
||||
{"TextMarshaler", Type, 2},
|
||||
{"TextUnmarshaler", Type, 2},
|
||||
},
|
||||
@ -5984,13 +6110,16 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*Interface).Complete", Method, 5},
|
||||
{"(*Interface).Embedded", Method, 5},
|
||||
{"(*Interface).EmbeddedType", Method, 11},
|
||||
{"(*Interface).EmbeddedTypes", Method, 24},
|
||||
{"(*Interface).Empty", Method, 5},
|
||||
{"(*Interface).ExplicitMethod", Method, 5},
|
||||
{"(*Interface).ExplicitMethods", Method, 24},
|
||||
{"(*Interface).IsComparable", Method, 18},
|
||||
{"(*Interface).IsImplicit", Method, 18},
|
||||
{"(*Interface).IsMethodSet", Method, 18},
|
||||
{"(*Interface).MarkImplicit", Method, 18},
|
||||
{"(*Interface).Method", Method, 5},
|
||||
{"(*Interface).Methods", Method, 24},
|
||||
{"(*Interface).NumEmbeddeds", Method, 5},
|
||||
{"(*Interface).NumExplicitMethods", Method, 5},
|
||||
{"(*Interface).NumMethods", Method, 5},
|
||||
@ -6011,9 +6140,11 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*MethodSet).At", Method, 5},
|
||||
{"(*MethodSet).Len", Method, 5},
|
||||
{"(*MethodSet).Lookup", Method, 5},
|
||||
{"(*MethodSet).Methods", Method, 24},
|
||||
{"(*MethodSet).String", Method, 5},
|
||||
{"(*Named).AddMethod", Method, 5},
|
||||
{"(*Named).Method", Method, 5},
|
||||
{"(*Named).Methods", Method, 24},
|
||||
{"(*Named).NumMethods", Method, 5},
|
||||
{"(*Named).Obj", Method, 5},
|
||||
{"(*Named).Origin", Method, 18},
|
||||
@ -6054,6 +6185,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*Pointer).String", Method, 5},
|
||||
{"(*Pointer).Underlying", Method, 5},
|
||||
{"(*Scope).Child", Method, 5},
|
||||
{"(*Scope).Children", Method, 24},
|
||||
{"(*Scope).Contains", Method, 5},
|
||||
{"(*Scope).End", Method, 5},
|
||||
{"(*Scope).Innermost", Method, 5},
|
||||
@ -6089,6 +6221,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*StdSizes).Offsetsof", Method, 5},
|
||||
{"(*StdSizes).Sizeof", Method, 5},
|
||||
{"(*Struct).Field", Method, 5},
|
||||
{"(*Struct).Fields", Method, 24},
|
||||
{"(*Struct).NumFields", Method, 5},
|
||||
{"(*Struct).String", Method, 5},
|
||||
{"(*Struct).Tag", Method, 5},
|
||||
@ -6100,8 +6233,10 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*Tuple).Len", Method, 5},
|
||||
{"(*Tuple).String", Method, 5},
|
||||
{"(*Tuple).Underlying", Method, 5},
|
||||
{"(*Tuple).Variables", Method, 24},
|
||||
{"(*TypeList).At", Method, 18},
|
||||
{"(*TypeList).Len", Method, 18},
|
||||
{"(*TypeList).Types", Method, 24},
|
||||
{"(*TypeName).Exported", Method, 5},
|
||||
{"(*TypeName).Id", Method, 5},
|
||||
{"(*TypeName).IsAlias", Method, 9},
|
||||
@ -6119,9 +6254,11 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*TypeParam).Underlying", Method, 18},
|
||||
{"(*TypeParamList).At", Method, 18},
|
||||
{"(*TypeParamList).Len", Method, 18},
|
||||
{"(*TypeParamList).TypeParams", Method, 24},
|
||||
{"(*Union).Len", Method, 18},
|
||||
{"(*Union).String", Method, 18},
|
||||
{"(*Union).Term", Method, 18},
|
||||
{"(*Union).Terms", Method, 24},
|
||||
{"(*Union).Underlying", Method, 18},
|
||||
{"(*Var).Anonymous", Method, 5},
|
||||
{"(*Var).Embedded", Method, 11},
|
||||
@ -6392,10 +6529,12 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*Hash).WriteByte", Method, 14},
|
||||
{"(*Hash).WriteString", Method, 14},
|
||||
{"Bytes", Func, 19},
|
||||
{"Comparable", Func, 24},
|
||||
{"Hash", Type, 14},
|
||||
{"MakeSeed", Func, 14},
|
||||
{"Seed", Type, 14},
|
||||
{"String", Func, 19},
|
||||
{"WriteComparable", Func, 24},
|
||||
},
|
||||
"html": {
|
||||
{"EscapeString", Func, 0},
|
||||
@ -7082,6 +7221,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*JSONHandler).WithGroup", Method, 21},
|
||||
{"(*Level).UnmarshalJSON", Method, 21},
|
||||
{"(*Level).UnmarshalText", Method, 21},
|
||||
{"(*LevelVar).AppendText", Method, 24},
|
||||
{"(*LevelVar).Level", Method, 21},
|
||||
{"(*LevelVar).MarshalText", Method, 21},
|
||||
{"(*LevelVar).Set", Method, 21},
|
||||
@ -7110,6 +7250,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(Attr).Equal", Method, 21},
|
||||
{"(Attr).String", Method, 21},
|
||||
{"(Kind).String", Method, 21},
|
||||
{"(Level).AppendText", Method, 24},
|
||||
{"(Level).Level", Method, 21},
|
||||
{"(Level).MarshalJSON", Method, 21},
|
||||
{"(Level).MarshalText", Method, 21},
|
||||
@ -7140,6 +7281,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Debug", Func, 21},
|
||||
{"DebugContext", Func, 21},
|
||||
{"Default", Func, 21},
|
||||
{"DiscardHandler", Var, 24},
|
||||
{"Duration", Func, 21},
|
||||
{"DurationValue", Func, 21},
|
||||
{"Error", Func, 21},
|
||||
@ -7375,6 +7517,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*Float).Acc", Method, 5},
|
||||
{"(*Float).Add", Method, 5},
|
||||
{"(*Float).Append", Method, 5},
|
||||
{"(*Float).AppendText", Method, 24},
|
||||
{"(*Float).Cmp", Method, 5},
|
||||
{"(*Float).Copy", Method, 5},
|
||||
{"(*Float).Float32", Method, 5},
|
||||
@ -7421,6 +7564,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*Int).And", Method, 0},
|
||||
{"(*Int).AndNot", Method, 0},
|
||||
{"(*Int).Append", Method, 6},
|
||||
{"(*Int).AppendText", Method, 24},
|
||||
{"(*Int).Binomial", Method, 0},
|
||||
{"(*Int).Bit", Method, 0},
|
||||
{"(*Int).BitLen", Method, 0},
|
||||
@ -7477,6 +7621,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*Int).Xor", Method, 0},
|
||||
{"(*Rat).Abs", Method, 0},
|
||||
{"(*Rat).Add", Method, 0},
|
||||
{"(*Rat).AppendText", Method, 24},
|
||||
{"(*Rat).Cmp", Method, 0},
|
||||
{"(*Rat).Denom", Method, 0},
|
||||
{"(*Rat).Float32", Method, 4},
|
||||
@ -7659,11 +7804,13 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Zipf", Type, 0},
|
||||
},
|
||||
"math/rand/v2": {
|
||||
{"(*ChaCha8).AppendBinary", Method, 24},
|
||||
{"(*ChaCha8).MarshalBinary", Method, 22},
|
||||
{"(*ChaCha8).Read", Method, 23},
|
||||
{"(*ChaCha8).Seed", Method, 22},
|
||||
{"(*ChaCha8).Uint64", Method, 22},
|
||||
{"(*ChaCha8).UnmarshalBinary", Method, 22},
|
||||
{"(*PCG).AppendBinary", Method, 24},
|
||||
{"(*PCG).MarshalBinary", Method, 22},
|
||||
{"(*PCG).Seed", Method, 22},
|
||||
{"(*PCG).Uint64", Method, 22},
|
||||
@ -7931,6 +8078,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*UnixListener).SyscallConn", Method, 10},
|
||||
{"(Flags).String", Method, 0},
|
||||
{"(HardwareAddr).String", Method, 0},
|
||||
{"(IP).AppendText", Method, 24},
|
||||
{"(IP).DefaultMask", Method, 0},
|
||||
{"(IP).Equal", Method, 0},
|
||||
{"(IP).IsGlobalUnicast", Method, 0},
|
||||
@ -8131,6 +8279,9 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*MaxBytesError).Error", Method, 19},
|
||||
{"(*ProtocolError).Error", Method, 0},
|
||||
{"(*ProtocolError).Is", Method, 21},
|
||||
{"(*Protocols).SetHTTP1", Method, 24},
|
||||
{"(*Protocols).SetHTTP2", Method, 24},
|
||||
{"(*Protocols).SetUnencryptedHTTP2", Method, 24},
|
||||
{"(*Request).AddCookie", Method, 0},
|
||||
{"(*Request).BasicAuth", Method, 4},
|
||||
{"(*Request).Clone", Method, 13},
|
||||
@ -8190,6 +8341,10 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(Header).Values", Method, 14},
|
||||
{"(Header).Write", Method, 0},
|
||||
{"(Header).WriteSubset", Method, 0},
|
||||
{"(Protocols).HTTP1", Method, 24},
|
||||
{"(Protocols).HTTP2", Method, 24},
|
||||
{"(Protocols).String", Method, 24},
|
||||
{"(Protocols).UnencryptedHTTP2", Method, 24},
|
||||
{"AllowQuerySemicolons", Func, 17},
|
||||
{"CanonicalHeaderKey", Func, 0},
|
||||
{"Client", Type, 0},
|
||||
@ -8252,6 +8407,18 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"FileSystem", Type, 0},
|
||||
{"Flusher", Type, 0},
|
||||
{"Get", Func, 0},
|
||||
{"HTTP2Config", Type, 24},
|
||||
{"HTTP2Config.CountError", Field, 24},
|
||||
{"HTTP2Config.MaxConcurrentStreams", Field, 24},
|
||||
{"HTTP2Config.MaxDecoderHeaderTableSize", Field, 24},
|
||||
{"HTTP2Config.MaxEncoderHeaderTableSize", Field, 24},
|
||||
{"HTTP2Config.MaxReadFrameSize", Field, 24},
|
||||
{"HTTP2Config.MaxReceiveBufferPerConnection", Field, 24},
|
||||
{"HTTP2Config.MaxReceiveBufferPerStream", Field, 24},
|
||||
{"HTTP2Config.PermitProhibitedCipherSuites", Field, 24},
|
||||
{"HTTP2Config.PingTimeout", Field, 24},
|
||||
{"HTTP2Config.SendPingTimeout", Field, 24},
|
||||
{"HTTP2Config.WriteByteTimeout", Field, 24},
|
||||
{"Handle", Func, 0},
|
||||
{"HandleFunc", Func, 0},
|
||||
{"Handler", Type, 0},
|
||||
@ -8292,6 +8459,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"PostForm", Func, 0},
|
||||
{"ProtocolError", Type, 0},
|
||||
{"ProtocolError.ErrorString", Field, 0},
|
||||
{"Protocols", Type, 24},
|
||||
{"ProxyFromEnvironment", Func, 0},
|
||||
{"ProxyURL", Func, 0},
|
||||
{"PushOptions", Type, 8},
|
||||
@ -8361,9 +8529,11 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Server.ConnState", Field, 3},
|
||||
{"Server.DisableGeneralOptionsHandler", Field, 20},
|
||||
{"Server.ErrorLog", Field, 3},
|
||||
{"Server.HTTP2", Field, 24},
|
||||
{"Server.Handler", Field, 0},
|
||||
{"Server.IdleTimeout", Field, 8},
|
||||
{"Server.MaxHeaderBytes", Field, 0},
|
||||
{"Server.Protocols", Field, 24},
|
||||
{"Server.ReadHeaderTimeout", Field, 8},
|
||||
{"Server.ReadTimeout", Field, 0},
|
||||
{"Server.TLSConfig", Field, 0},
|
||||
@ -8453,12 +8623,14 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Transport.ExpectContinueTimeout", Field, 6},
|
||||
{"Transport.ForceAttemptHTTP2", Field, 13},
|
||||
{"Transport.GetProxyConnectHeader", Field, 16},
|
||||
{"Transport.HTTP2", Field, 24},
|
||||
{"Transport.IdleConnTimeout", Field, 7},
|
||||
{"Transport.MaxConnsPerHost", Field, 11},
|
||||
{"Transport.MaxIdleConns", Field, 7},
|
||||
{"Transport.MaxIdleConnsPerHost", Field, 0},
|
||||
{"Transport.MaxResponseHeaderBytes", Field, 7},
|
||||
{"Transport.OnProxyConnectResponse", Field, 20},
|
||||
{"Transport.Protocols", Field, 24},
|
||||
{"Transport.Proxy", Field, 0},
|
||||
{"Transport.ProxyConnectHeader", Field, 8},
|
||||
{"Transport.ReadBufferSize", Field, 13},
|
||||
@ -8646,6 +8818,8 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*AddrPort).UnmarshalText", Method, 18},
|
||||
{"(*Prefix).UnmarshalBinary", Method, 18},
|
||||
{"(*Prefix).UnmarshalText", Method, 18},
|
||||
{"(Addr).AppendBinary", Method, 24},
|
||||
{"(Addr).AppendText", Method, 24},
|
||||
{"(Addr).AppendTo", Method, 18},
|
||||
{"(Addr).As16", Method, 18},
|
||||
{"(Addr).As4", Method, 18},
|
||||
@ -8676,6 +8850,8 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(Addr).WithZone", Method, 18},
|
||||
{"(Addr).Zone", Method, 18},
|
||||
{"(AddrPort).Addr", Method, 18},
|
||||
{"(AddrPort).AppendBinary", Method, 24},
|
||||
{"(AddrPort).AppendText", Method, 24},
|
||||
{"(AddrPort).AppendTo", Method, 18},
|
||||
{"(AddrPort).Compare", Method, 22},
|
||||
{"(AddrPort).IsValid", Method, 18},
|
||||
@ -8684,6 +8860,8 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(AddrPort).Port", Method, 18},
|
||||
{"(AddrPort).String", Method, 18},
|
||||
{"(Prefix).Addr", Method, 18},
|
||||
{"(Prefix).AppendBinary", Method, 24},
|
||||
{"(Prefix).AppendText", Method, 24},
|
||||
{"(Prefix).AppendTo", Method, 18},
|
||||
{"(Prefix).Bits", Method, 18},
|
||||
{"(Prefix).Contains", Method, 18},
|
||||
@ -8868,6 +9046,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*Error).Temporary", Method, 6},
|
||||
{"(*Error).Timeout", Method, 6},
|
||||
{"(*Error).Unwrap", Method, 13},
|
||||
{"(*URL).AppendBinary", Method, 24},
|
||||
{"(*URL).EscapedFragment", Method, 15},
|
||||
{"(*URL).EscapedPath", Method, 5},
|
||||
{"(*URL).Hostname", Method, 8},
|
||||
@ -8967,6 +9146,17 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*ProcessState).SysUsage", Method, 0},
|
||||
{"(*ProcessState).SystemTime", Method, 0},
|
||||
{"(*ProcessState).UserTime", Method, 0},
|
||||
{"(*Root).Close", Method, 24},
|
||||
{"(*Root).Create", Method, 24},
|
||||
{"(*Root).FS", Method, 24},
|
||||
{"(*Root).Lstat", Method, 24},
|
||||
{"(*Root).Mkdir", Method, 24},
|
||||
{"(*Root).Name", Method, 24},
|
||||
{"(*Root).Open", Method, 24},
|
||||
{"(*Root).OpenFile", Method, 24},
|
||||
{"(*Root).OpenRoot", Method, 24},
|
||||
{"(*Root).Remove", Method, 24},
|
||||
{"(*Root).Stat", Method, 24},
|
||||
{"(*SyscallError).Error", Method, 0},
|
||||
{"(*SyscallError).Timeout", Method, 10},
|
||||
{"(*SyscallError).Unwrap", Method, 13},
|
||||
@ -9060,6 +9250,8 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"O_WRONLY", Const, 0},
|
||||
{"Open", Func, 0},
|
||||
{"OpenFile", Func, 0},
|
||||
{"OpenInRoot", Func, 24},
|
||||
{"OpenRoot", Func, 24},
|
||||
{"PathError", Type, 0},
|
||||
{"PathError.Err", Field, 0},
|
||||
{"PathError.Op", Field, 0},
|
||||
@ -9081,6 +9273,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Remove", Func, 0},
|
||||
{"RemoveAll", Func, 0},
|
||||
{"Rename", Func, 0},
|
||||
{"Root", Type, 24},
|
||||
{"SEEK_CUR", Const, 0},
|
||||
{"SEEK_END", Const, 0},
|
||||
{"SEEK_SET", Const, 0},
|
||||
@ -9422,6 +9615,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Zero", Func, 0},
|
||||
},
|
||||
"regexp": {
|
||||
{"(*Regexp).AppendText", Method, 24},
|
||||
{"(*Regexp).Copy", Method, 6},
|
||||
{"(*Regexp).Expand", Method, 0},
|
||||
{"(*Regexp).ExpandString", Method, 0},
|
||||
@ -9602,6 +9796,8 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*StackRecord).Stack", Method, 0},
|
||||
{"(*TypeAssertionError).Error", Method, 0},
|
||||
{"(*TypeAssertionError).RuntimeError", Method, 0},
|
||||
{"(Cleanup).Stop", Method, 24},
|
||||
{"AddCleanup", Func, 24},
|
||||
{"BlockProfile", Func, 1},
|
||||
{"BlockProfileRecord", Type, 1},
|
||||
{"BlockProfileRecord.Count", Field, 1},
|
||||
@ -9612,6 +9808,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Caller", Func, 0},
|
||||
{"Callers", Func, 0},
|
||||
{"CallersFrames", Func, 7},
|
||||
{"Cleanup", Type, 24},
|
||||
{"Compiler", Const, 0},
|
||||
{"Error", Type, 0},
|
||||
{"Frame", Type, 7},
|
||||
@ -9974,6 +10171,8 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"EqualFold", Func, 0},
|
||||
{"Fields", Func, 0},
|
||||
{"FieldsFunc", Func, 0},
|
||||
{"FieldsFuncSeq", Func, 24},
|
||||
{"FieldsSeq", Func, 24},
|
||||
{"HasPrefix", Func, 0},
|
||||
{"HasSuffix", Func, 0},
|
||||
{"Index", Func, 0},
|
||||
@ -9986,6 +10185,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"LastIndexAny", Func, 0},
|
||||
{"LastIndexByte", Func, 5},
|
||||
{"LastIndexFunc", Func, 0},
|
||||
{"Lines", Func, 24},
|
||||
{"Map", Func, 0},
|
||||
{"NewReader", Func, 0},
|
||||
{"NewReplacer", Func, 0},
|
||||
@ -9997,7 +10197,9 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"Split", Func, 0},
|
||||
{"SplitAfter", Func, 0},
|
||||
{"SplitAfterN", Func, 0},
|
||||
{"SplitAfterSeq", Func, 24},
|
||||
{"SplitN", Func, 0},
|
||||
{"SplitSeq", Func, 24},
|
||||
{"Title", Func, 0},
|
||||
{"ToLower", Func, 0},
|
||||
{"ToLowerSpecial", Func, 0},
|
||||
@ -16413,7 +16615,9 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"ValueOf", Func, 0},
|
||||
},
|
||||
"testing": {
|
||||
{"(*B).Chdir", Method, 24},
|
||||
{"(*B).Cleanup", Method, 14},
|
||||
{"(*B).Context", Method, 24},
|
||||
{"(*B).Elapsed", Method, 20},
|
||||
{"(*B).Error", Method, 0},
|
||||
{"(*B).Errorf", Method, 0},
|
||||
@ -16425,6 +16629,7 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*B).Helper", Method, 9},
|
||||
{"(*B).Log", Method, 0},
|
||||
{"(*B).Logf", Method, 0},
|
||||
{"(*B).Loop", Method, 24},
|
||||
{"(*B).Name", Method, 8},
|
||||
{"(*B).ReportAllocs", Method, 1},
|
||||
{"(*B).ReportMetric", Method, 13},
|
||||
@ -16442,7 +16647,9 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*B).StopTimer", Method, 0},
|
||||
{"(*B).TempDir", Method, 15},
|
||||
{"(*F).Add", Method, 18},
|
||||
{"(*F).Chdir", Method, 24},
|
||||
{"(*F).Cleanup", Method, 18},
|
||||
{"(*F).Context", Method, 24},
|
||||
{"(*F).Error", Method, 18},
|
||||
{"(*F).Errorf", Method, 18},
|
||||
{"(*F).Fail", Method, 18},
|
||||
@ -16463,7 +16670,9 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(*F).TempDir", Method, 18},
|
||||
{"(*M).Run", Method, 4},
|
||||
{"(*PB).Next", Method, 3},
|
||||
{"(*T).Chdir", Method, 24},
|
||||
{"(*T).Cleanup", Method, 14},
|
||||
{"(*T).Context", Method, 24},
|
||||
{"(*T).Deadline", Method, 15},
|
||||
{"(*T).Error", Method, 0},
|
||||
{"(*T).Errorf", Method, 0},
|
||||
@ -16954,7 +17163,9 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"(Time).Add", Method, 0},
|
||||
{"(Time).AddDate", Method, 0},
|
||||
{"(Time).After", Method, 0},
|
||||
{"(Time).AppendBinary", Method, 24},
|
||||
{"(Time).AppendFormat", Method, 5},
|
||||
{"(Time).AppendText", Method, 24},
|
||||
{"(Time).Before", Method, 0},
|
||||
{"(Time).Clock", Method, 0},
|
||||
{"(Time).Compare", Method, 20},
|
||||
@ -17428,4 +17639,9 @@ var PackageSymbols = map[string][]Symbol{
|
||||
{"String", Func, 0},
|
||||
{"StringData", Func, 0},
|
||||
},
|
||||
"weak": {
|
||||
{"(Pointer).Value", Method, 24},
|
||||
{"Make", Func, 24},
|
||||
{"Pointer", Type, 24},
|
||||
},
|
||||
}
|
||||
|
2
vendor/golang.org/x/tools/internal/stdlib/stdlib.go
generated
vendored
2
vendor/golang.org/x/tools/internal/stdlib/stdlib.go
generated
vendored
@ -6,7 +6,7 @@
|
||||
|
||||
// Package stdlib provides a table of all exported symbols in the
|
||||
// standard library, along with the version at which they first
|
||||
// appeared.
|
||||
// appeared. It also provides the import graph of std packages.
|
||||
package stdlib
|
||||
|
||||
import (
|
||||
|
72
vendor/golang.org/x/tools/internal/typeparams/common.go
generated
vendored
72
vendor/golang.org/x/tools/internal/typeparams/common.go
generated
vendored
@ -66,75 +66,3 @@ func IsTypeParam(t types.Type) bool {
|
||||
_, ok := types.Unalias(t).(*types.TypeParam)
|
||||
return ok
|
||||
}
|
||||
|
||||
// GenericAssignableTo is a generalization of types.AssignableTo that
|
||||
// implements the following rule for uninstantiated generic types:
|
||||
//
|
||||
// If V and T are generic named types, then V is considered assignable to T if,
|
||||
// for every possible instantiation of V[A_1, ..., A_N], the instantiation
|
||||
// T[A_1, ..., A_N] is valid and V[A_1, ..., A_N] implements T[A_1, ..., A_N].
|
||||
//
|
||||
// If T has structural constraints, they must be satisfied by V.
|
||||
//
|
||||
// For example, consider the following type declarations:
|
||||
//
|
||||
// type Interface[T any] interface {
|
||||
// Accept(T)
|
||||
// }
|
||||
//
|
||||
// type Container[T any] struct {
|
||||
// Element T
|
||||
// }
|
||||
//
|
||||
// func (c Container[T]) Accept(t T) { c.Element = t }
|
||||
//
|
||||
// In this case, GenericAssignableTo reports that instantiations of Container
|
||||
// are assignable to the corresponding instantiation of Interface.
|
||||
func GenericAssignableTo(ctxt *types.Context, V, T types.Type) bool {
|
||||
V = types.Unalias(V)
|
||||
T = types.Unalias(T)
|
||||
|
||||
// If V and T are not both named, or do not have matching non-empty type
|
||||
// parameter lists, fall back on types.AssignableTo.
|
||||
|
||||
VN, Vnamed := V.(*types.Named)
|
||||
TN, Tnamed := T.(*types.Named)
|
||||
if !Vnamed || !Tnamed {
|
||||
return types.AssignableTo(V, T)
|
||||
}
|
||||
|
||||
vtparams := VN.TypeParams()
|
||||
ttparams := TN.TypeParams()
|
||||
if vtparams.Len() == 0 || vtparams.Len() != ttparams.Len() || VN.TypeArgs().Len() != 0 || TN.TypeArgs().Len() != 0 {
|
||||
return types.AssignableTo(V, T)
|
||||
}
|
||||
|
||||
// V and T have the same (non-zero) number of type params. Instantiate both
|
||||
// with the type parameters of V. This must always succeed for V, and will
|
||||
// succeed for T if and only if the type set of each type parameter of V is a
|
||||
// subset of the type set of the corresponding type parameter of T, meaning
|
||||
// that every instantiation of V corresponds to a valid instantiation of T.
|
||||
|
||||
// Minor optimization: ensure we share a context across the two
|
||||
// instantiations below.
|
||||
if ctxt == nil {
|
||||
ctxt = types.NewContext()
|
||||
}
|
||||
|
||||
var targs []types.Type
|
||||
for i := 0; i < vtparams.Len(); i++ {
|
||||
targs = append(targs, vtparams.At(i))
|
||||
}
|
||||
|
||||
vinst, err := types.Instantiate(ctxt, V, targs, true)
|
||||
if err != nil {
|
||||
panic("type parameters should satisfy their own constraints")
|
||||
}
|
||||
|
||||
tinst, err := types.Instantiate(ctxt, T, targs, true)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return types.AssignableTo(vinst, tinst)
|
||||
}
|
||||
|
11
vendor/golang.org/x/tools/internal/typeparams/coretype.go
generated
vendored
11
vendor/golang.org/x/tools/internal/typeparams/coretype.go
generated
vendored
@ -109,8 +109,13 @@ func CoreType(T types.Type) types.Type {
|
||||
//
|
||||
// NormalTerms makes no guarantees about the order of terms, except that it
|
||||
// is deterministic.
|
||||
func NormalTerms(typ types.Type) ([]*types.Term, error) {
|
||||
switch typ := typ.Underlying().(type) {
|
||||
func NormalTerms(T types.Type) ([]*types.Term, error) {
|
||||
// typeSetOf(T) == typeSetOf(Unalias(T))
|
||||
typ := types.Unalias(T)
|
||||
if named, ok := typ.(*types.Named); ok {
|
||||
typ = named.Underlying()
|
||||
}
|
||||
switch typ := typ.(type) {
|
||||
case *types.TypeParam:
|
||||
return StructuralTerms(typ)
|
||||
case *types.Union:
|
||||
@ -118,7 +123,7 @@ func NormalTerms(typ types.Type) ([]*types.Term, error) {
|
||||
case *types.Interface:
|
||||
return InterfaceTermSet(typ)
|
||||
default:
|
||||
return []*types.Term{types.NewTerm(false, typ)}, nil
|
||||
return []*types.Term{types.NewTerm(false, T)}, nil
|
||||
}
|
||||
}
|
||||
|
||||
|
2
vendor/golang.org/x/tools/internal/typeparams/free.go
generated
vendored
2
vendor/golang.org/x/tools/internal/typeparams/free.go
generated
vendored
@ -70,7 +70,7 @@ func (w *Free) Has(typ types.Type) (res bool) {
|
||||
|
||||
case *types.Tuple:
|
||||
n := t.Len()
|
||||
for i := 0; i < n; i++ {
|
||||
for i := range n {
|
||||
if w.Has(t.At(i).Type()) {
|
||||
return true
|
||||
}
|
||||
|
2
vendor/golang.org/x/tools/internal/typeparams/normalize.go
generated
vendored
2
vendor/golang.org/x/tools/internal/typeparams/normalize.go
generated
vendored
@ -120,7 +120,7 @@ type termSet struct {
|
||||
terms termlist
|
||||
}
|
||||
|
||||
func indentf(depth int, format string, args ...interface{}) {
|
||||
func indentf(depth int, format string, args ...any) {
|
||||
fmt.Fprintf(os.Stderr, strings.Repeat(".", depth)+format+"\n", args...)
|
||||
}
|
||||
|
||||
|
12
vendor/golang.org/x/tools/internal/typeparams/termlist.go
generated
vendored
12
vendor/golang.org/x/tools/internal/typeparams/termlist.go
generated
vendored
@ -1,3 +1,6 @@
|
||||
// Code generated by "go test -run=Generate -write=all"; DO NOT EDIT.
|
||||
// Source: ../../cmd/compile/internal/types2/termlist.go
|
||||
|
||||
// Copyright 2021 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.
|
||||
@ -7,8 +10,8 @@
|
||||
package typeparams
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"go/types"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// A termlist represents the type set represented by the union
|
||||
@ -22,15 +25,18 @@ type termlist []*term
|
||||
// It is in normal form.
|
||||
var allTermlist = termlist{new(term)}
|
||||
|
||||
// termSep is the separator used between individual terms.
|
||||
const termSep = " | "
|
||||
|
||||
// String prints the termlist exactly (without normalization).
|
||||
func (xl termlist) String() string {
|
||||
if len(xl) == 0 {
|
||||
return "∅"
|
||||
}
|
||||
var buf bytes.Buffer
|
||||
var buf strings.Builder
|
||||
for i, x := range xl {
|
||||
if i > 0 {
|
||||
buf.WriteString(" | ")
|
||||
buf.WriteString(termSep)
|
||||
}
|
||||
buf.WriteString(x.String())
|
||||
}
|
||||
|
3
vendor/golang.org/x/tools/internal/typeparams/typeterm.go
generated
vendored
3
vendor/golang.org/x/tools/internal/typeparams/typeterm.go
generated
vendored
@ -1,3 +1,6 @@
|
||||
// Code generated by "go test -run=Generate -write=all"; DO NOT EDIT.
|
||||
// Source: ../../cmd/compile/internal/types2/typeterm.go
|
||||
|
||||
// Copyright 2021 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.
|
||||
|
135
vendor/golang.org/x/tools/internal/typesinternal/classify_call.go
generated
vendored
Normal file
135
vendor/golang.org/x/tools/internal/typesinternal/classify_call.go
generated
vendored
Normal file
@ -0,0 +1,135 @@
|
||||
// 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 typesinternal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go/ast"
|
||||
"go/types"
|
||||
_ "unsafe"
|
||||
)
|
||||
|
||||
// CallKind describes the function position of an [*ast.CallExpr].
|
||||
type CallKind int
|
||||
|
||||
const (
|
||||
CallStatic CallKind = iota // static call to known function
|
||||
CallInterface // dynamic call through an interface method
|
||||
CallDynamic // dynamic call of a func value
|
||||
CallBuiltin // call to a builtin function
|
||||
CallConversion // a conversion (not a call)
|
||||
)
|
||||
|
||||
var callKindNames = []string{
|
||||
"CallStatic",
|
||||
"CallInterface",
|
||||
"CallDynamic",
|
||||
"CallBuiltin",
|
||||
"CallConversion",
|
||||
}
|
||||
|
||||
func (k CallKind) String() string {
|
||||
if i := int(k); i >= 0 && i < len(callKindNames) {
|
||||
return callKindNames[i]
|
||||
}
|
||||
return fmt.Sprintf("typeutil.CallKind(%d)", k)
|
||||
}
|
||||
|
||||
// ClassifyCall classifies the function position of a call expression ([*ast.CallExpr]).
|
||||
// It distinguishes among true function calls, calls to builtins, and type conversions,
|
||||
// and further classifies function calls as static calls (where the function is known),
|
||||
// dynamic interface calls, and other dynamic calls.
|
||||
//
|
||||
// For the declarations:
|
||||
//
|
||||
// func f() {}
|
||||
// func g[T any]() {}
|
||||
// var v func()
|
||||
// var s []func()
|
||||
// type I interface { M() }
|
||||
// var i I
|
||||
//
|
||||
// ClassifyCall returns the following:
|
||||
//
|
||||
// f() CallStatic
|
||||
// g[int]() CallStatic
|
||||
// i.M() CallInterface
|
||||
// min(1, 2) CallBuiltin
|
||||
// v() CallDynamic
|
||||
// s[0]() CallDynamic
|
||||
// int(x) CallConversion
|
||||
// []byte("") CallConversion
|
||||
func ClassifyCall(info *types.Info, call *ast.CallExpr) CallKind {
|
||||
if info.Types == nil {
|
||||
panic("ClassifyCall: info.Types is nil")
|
||||
}
|
||||
if info.Types[call.Fun].IsType() {
|
||||
return CallConversion
|
||||
}
|
||||
obj := info.Uses[UsedIdent(info, call.Fun)]
|
||||
// Classify the call by the type of the object, if any.
|
||||
switch obj := obj.(type) {
|
||||
case *types.Builtin:
|
||||
return CallBuiltin
|
||||
case *types.Func:
|
||||
if interfaceMethod(obj) {
|
||||
return CallInterface
|
||||
}
|
||||
return CallStatic
|
||||
default:
|
||||
return CallDynamic
|
||||
}
|
||||
}
|
||||
|
||||
// UsedIdent returns the identifier such that info.Uses[UsedIdent(info, e)]
|
||||
// is the [types.Object] used by e, if any.
|
||||
//
|
||||
// If e is one of various forms of reference:
|
||||
//
|
||||
// f, c, v, T lexical reference
|
||||
// pkg.X qualified identifier
|
||||
// f[T] or pkg.F[K,V] instantiations of the above kinds
|
||||
// expr.f field or method value selector
|
||||
// T.f method expression selector
|
||||
//
|
||||
// UsedIdent returns the identifier whose is associated value in [types.Info.Uses]
|
||||
// is the object to which it refers.
|
||||
//
|
||||
// For the declarations:
|
||||
//
|
||||
// func F[T any] {...}
|
||||
// type I interface { M() }
|
||||
// var (
|
||||
// x int
|
||||
// s struct { f int }
|
||||
// a []int
|
||||
// i I
|
||||
// )
|
||||
//
|
||||
// UsedIdent returns the following:
|
||||
//
|
||||
// Expr UsedIdent
|
||||
// x x
|
||||
// s.f f
|
||||
// F[int] F
|
||||
// i.M M
|
||||
// I.M M
|
||||
// min min
|
||||
// int int
|
||||
// 1 nil
|
||||
// a[0] nil
|
||||
// []byte nil
|
||||
//
|
||||
// Note: if e is an instantiated function or method, UsedIdent returns
|
||||
// the corresponding generic function or method on the generic type.
|
||||
func UsedIdent(info *types.Info, e ast.Expr) *ast.Ident {
|
||||
return usedIdent(info, e)
|
||||
}
|
||||
|
||||
//go:linkname usedIdent golang.org/x/tools/go/types/typeutil.usedIdent
|
||||
func usedIdent(info *types.Info, e ast.Expr) *ast.Ident
|
||||
|
||||
//go:linkname interfaceMethod golang.org/x/tools/go/types/typeutil.interfaceMethod
|
||||
func interfaceMethod(f *types.Func) bool
|
2
vendor/golang.org/x/tools/internal/typesinternal/errorcode.go
generated
vendored
2
vendor/golang.org/x/tools/internal/typesinternal/errorcode.go
generated
vendored
@ -966,7 +966,7 @@ const (
|
||||
// var _ = string(x)
|
||||
InvalidConversion
|
||||
|
||||
// InvalidUntypedConversion occurs when an there is no valid implicit
|
||||
// InvalidUntypedConversion occurs when there is no valid implicit
|
||||
// conversion from an untyped value satisfying the type constraints of the
|
||||
// context in which it is used.
|
||||
//
|
||||
|
46
vendor/golang.org/x/tools/internal/typesinternal/qualifier.go
generated
vendored
Normal file
46
vendor/golang.org/x/tools/internal/typesinternal/qualifier.go
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
// 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 typesinternal
|
||||
|
||||
import (
|
||||
"go/ast"
|
||||
"go/types"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// FileQualifier returns a [types.Qualifier] function that qualifies
|
||||
// imported symbols appropriately based on the import environment of a given
|
||||
// file.
|
||||
// If the same package is imported multiple times, the last appearance is
|
||||
// recorded.
|
||||
func FileQualifier(f *ast.File, pkg *types.Package) types.Qualifier {
|
||||
// Construct mapping of import paths to their defined names.
|
||||
// It is only necessary to look at renaming imports.
|
||||
imports := make(map[string]string)
|
||||
for _, imp := range f.Imports {
|
||||
if imp.Name != nil && imp.Name.Name != "_" {
|
||||
path, _ := strconv.Unquote(imp.Path.Value)
|
||||
imports[path] = imp.Name.Name
|
||||
}
|
||||
}
|
||||
|
||||
// Define qualifier to replace full package paths with names of the imports.
|
||||
return func(p *types.Package) string {
|
||||
if p == nil || p == pkg {
|
||||
return ""
|
||||
}
|
||||
|
||||
if name, ok := imports[p.Path()]; ok {
|
||||
if name == "." {
|
||||
return ""
|
||||
} else {
|
||||
return name
|
||||
}
|
||||
}
|
||||
|
||||
// If there is no local renaming, fall back to the package name.
|
||||
return p.Name()
|
||||
}
|
||||
}
|
3
vendor/golang.org/x/tools/internal/typesinternal/recv.go
generated
vendored
3
vendor/golang.org/x/tools/internal/typesinternal/recv.go
generated
vendored
@ -11,6 +11,9 @@ import (
|
||||
// ReceiverNamed returns the named type (if any) associated with the
|
||||
// type of recv, which may be of the form N or *N, or aliases thereof.
|
||||
// It also reports whether a Pointer was present.
|
||||
//
|
||||
// The named result may be nil if recv is from a method on an
|
||||
// anonymous interface or struct types or in ill-typed code.
|
||||
func ReceiverNamed(recv *types.Var) (isPtr bool, named *types.Named) {
|
||||
t := recv.Type()
|
||||
if ptr, ok := types.Unalias(t).(*types.Pointer); ok {
|
||||
|
27
vendor/golang.org/x/tools/internal/typesinternal/types.go
generated
vendored
27
vendor/golang.org/x/tools/internal/typesinternal/types.go
generated
vendored
@ -7,6 +7,7 @@
|
||||
package typesinternal
|
||||
|
||||
import (
|
||||
"go/ast"
|
||||
"go/token"
|
||||
"go/types"
|
||||
"reflect"
|
||||
@ -32,12 +33,14 @@ func SetUsesCgo(conf *types.Config) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// ReadGo116ErrorData extracts additional information from types.Error values
|
||||
// ErrorCodeStartEnd extracts additional information from types.Error values
|
||||
// generated by Go version 1.16 and later: the error code, start position, and
|
||||
// end position. If all positions are valid, start <= err.Pos <= end.
|
||||
//
|
||||
// If the data could not be read, the final result parameter will be false.
|
||||
func ReadGo116ErrorData(err types.Error) (code ErrorCode, start, end token.Pos, ok bool) {
|
||||
//
|
||||
// TODO(adonovan): eliminate start/end when proposal #71803 is accepted.
|
||||
func ErrorCodeStartEnd(err types.Error) (code ErrorCode, start, end token.Pos, ok bool) {
|
||||
var data [3]int
|
||||
// By coincidence all of these fields are ints, which simplifies things.
|
||||
v := reflect.ValueOf(err)
|
||||
@ -82,6 +85,7 @@ func NameRelativeTo(pkg *types.Package) types.Qualifier {
|
||||
type NamedOrAlias interface {
|
||||
types.Type
|
||||
Obj() *types.TypeName
|
||||
// TODO(hxjiang): add method TypeArgs() *types.TypeList after stop supporting go1.22.
|
||||
}
|
||||
|
||||
// TypeParams is a light shim around t.TypeParams().
|
||||
@ -119,3 +123,22 @@ func Origin(t NamedOrAlias) NamedOrAlias {
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
// IsPackageLevel reports whether obj is a package-level symbol.
|
||||
func IsPackageLevel(obj types.Object) bool {
|
||||
return obj.Pkg() != nil && obj.Parent() == obj.Pkg().Scope()
|
||||
}
|
||||
|
||||
// NewTypesInfo returns a *types.Info with all maps populated.
|
||||
func NewTypesInfo() *types.Info {
|
||||
return &types.Info{
|
||||
Types: map[ast.Expr]types.TypeAndValue{},
|
||||
Instances: map[*ast.Ident]types.Instance{},
|
||||
Defs: map[*ast.Ident]types.Object{},
|
||||
Uses: map[*ast.Ident]types.Object{},
|
||||
Implicits: map[ast.Node]types.Object{},
|
||||
Selections: map[*ast.SelectorExpr]*types.Selection{},
|
||||
Scopes: map[ast.Node]*types.Scope{},
|
||||
FileVersions: map[*ast.File]string{},
|
||||
}
|
||||
}
|
||||
|
40
vendor/golang.org/x/tools/internal/typesinternal/varkind.go
generated
vendored
Normal file
40
vendor/golang.org/x/tools/internal/typesinternal/varkind.go
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
// 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 typesinternal
|
||||
|
||||
// TODO(adonovan): when CL 645115 lands, define the go1.25 version of
|
||||
// this API that actually does something.
|
||||
|
||||
import "go/types"
|
||||
|
||||
type VarKind uint8
|
||||
|
||||
const (
|
||||
_ VarKind = iota // (not meaningful)
|
||||
PackageVar // a package-level variable
|
||||
LocalVar // a local variable
|
||||
RecvVar // a method receiver variable
|
||||
ParamVar // a function parameter variable
|
||||
ResultVar // a function result variable
|
||||
FieldVar // a struct field
|
||||
)
|
||||
|
||||
func (kind VarKind) String() string {
|
||||
return [...]string{
|
||||
0: "VarKind(0)",
|
||||
PackageVar: "PackageVar",
|
||||
LocalVar: "LocalVar",
|
||||
RecvVar: "RecvVar",
|
||||
ParamVar: "ParamVar",
|
||||
ResultVar: "ResultVar",
|
||||
FieldVar: "FieldVar",
|
||||
}[kind]
|
||||
}
|
||||
|
||||
// GetVarKind returns an invalid VarKind.
|
||||
func GetVarKind(v *types.Var) VarKind { return 0 }
|
||||
|
||||
// SetVarKind has no effect.
|
||||
func SetVarKind(v *types.Var, kind VarKind) {}
|
392
vendor/golang.org/x/tools/internal/typesinternal/zerovalue.go
generated
vendored
Normal file
392
vendor/golang.org/x/tools/internal/typesinternal/zerovalue.go
generated
vendored
Normal file
@ -0,0 +1,392 @@
|
||||
// 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 typesinternal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go/ast"
|
||||
"go/token"
|
||||
"go/types"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ZeroString returns the string representation of the zero value for any type t.
|
||||
// The boolean result indicates whether the type is or contains an invalid type
|
||||
// or a non-basic (constraint) interface type.
|
||||
//
|
||||
// Even for invalid input types, ZeroString may return a partially correct
|
||||
// string representation. The caller should use the returned isValid boolean
|
||||
// to determine the validity of the expression.
|
||||
//
|
||||
// When assigning to a wider type (such as 'any'), it's the caller's
|
||||
// responsibility to handle any necessary type conversions.
|
||||
//
|
||||
// This string can be used on the right-hand side of an assignment where the
|
||||
// left-hand side has that explicit type.
|
||||
// References to named types are qualified by an appropriate (optional)
|
||||
// qualifier function.
|
||||
// Exception: This does not apply to tuples. Their string representation is
|
||||
// informational only and cannot be used in an assignment.
|
||||
//
|
||||
// See [ZeroExpr] for a variant that returns an [ast.Expr].
|
||||
func ZeroString(t types.Type, qual types.Qualifier) (_ string, isValid bool) {
|
||||
switch t := t.(type) {
|
||||
case *types.Basic:
|
||||
switch {
|
||||
case t.Info()&types.IsBoolean != 0:
|
||||
return "false", true
|
||||
case t.Info()&types.IsNumeric != 0:
|
||||
return "0", true
|
||||
case t.Info()&types.IsString != 0:
|
||||
return `""`, true
|
||||
case t.Kind() == types.UnsafePointer:
|
||||
fallthrough
|
||||
case t.Kind() == types.UntypedNil:
|
||||
return "nil", true
|
||||
case t.Kind() == types.Invalid:
|
||||
return "invalid", false
|
||||
default:
|
||||
panic(fmt.Sprintf("ZeroString for unexpected type %v", t))
|
||||
}
|
||||
|
||||
case *types.Pointer, *types.Slice, *types.Chan, *types.Map, *types.Signature:
|
||||
return "nil", true
|
||||
|
||||
case *types.Interface:
|
||||
if !t.IsMethodSet() {
|
||||
return "invalid", false
|
||||
}
|
||||
return "nil", true
|
||||
|
||||
case *types.Named:
|
||||
switch under := t.Underlying().(type) {
|
||||
case *types.Struct, *types.Array:
|
||||
return types.TypeString(t, qual) + "{}", true
|
||||
default:
|
||||
return ZeroString(under, qual)
|
||||
}
|
||||
|
||||
case *types.Alias:
|
||||
switch t.Underlying().(type) {
|
||||
case *types.Struct, *types.Array:
|
||||
return types.TypeString(t, qual) + "{}", true
|
||||
default:
|
||||
// A type parameter can have alias but alias type's underlying type
|
||||
// can never be a type parameter.
|
||||
// Use types.Unalias to preserve the info of type parameter instead
|
||||
// of call Underlying() going right through and get the underlying
|
||||
// type of the type parameter which is always an interface.
|
||||
return ZeroString(types.Unalias(t), qual)
|
||||
}
|
||||
|
||||
case *types.Array, *types.Struct:
|
||||
return types.TypeString(t, qual) + "{}", true
|
||||
|
||||
case *types.TypeParam:
|
||||
// Assumes func new is not shadowed.
|
||||
return "*new(" + types.TypeString(t, qual) + ")", true
|
||||
|
||||
case *types.Tuple:
|
||||
// Tuples are not normal values.
|
||||
// We are currently format as "(t[0], ..., t[n])". Could be something else.
|
||||
isValid := true
|
||||
components := make([]string, t.Len())
|
||||
for i := 0; i < t.Len(); i++ {
|
||||
comp, ok := ZeroString(t.At(i).Type(), qual)
|
||||
|
||||
components[i] = comp
|
||||
isValid = isValid && ok
|
||||
}
|
||||
return "(" + strings.Join(components, ", ") + ")", isValid
|
||||
|
||||
case *types.Union:
|
||||
// Variables of these types cannot be created, so it makes
|
||||
// no sense to ask for their zero value.
|
||||
panic(fmt.Sprintf("invalid type for a variable: %v", t))
|
||||
|
||||
default:
|
||||
panic(t) // unreachable.
|
||||
}
|
||||
}
|
||||
|
||||
// ZeroExpr returns the ast.Expr representation of the zero value for any type t.
|
||||
// The boolean result indicates whether the type is or contains an invalid type
|
||||
// or a non-basic (constraint) interface type.
|
||||
//
|
||||
// Even for invalid input types, ZeroExpr may return a partially correct ast.Expr
|
||||
// representation. The caller should use the returned isValid boolean to determine
|
||||
// the validity of the expression.
|
||||
//
|
||||
// This function is designed for types suitable for variables and should not be
|
||||
// used with Tuple or Union types.References to named types are qualified by an
|
||||
// appropriate (optional) qualifier function.
|
||||
//
|
||||
// See [ZeroString] for a variant that returns a string.
|
||||
func ZeroExpr(t types.Type, qual types.Qualifier) (_ ast.Expr, isValid bool) {
|
||||
switch t := t.(type) {
|
||||
case *types.Basic:
|
||||
switch {
|
||||
case t.Info()&types.IsBoolean != 0:
|
||||
return &ast.Ident{Name: "false"}, true
|
||||
case t.Info()&types.IsNumeric != 0:
|
||||
return &ast.BasicLit{Kind: token.INT, Value: "0"}, true
|
||||
case t.Info()&types.IsString != 0:
|
||||
return &ast.BasicLit{Kind: token.STRING, Value: `""`}, true
|
||||
case t.Kind() == types.UnsafePointer:
|
||||
fallthrough
|
||||
case t.Kind() == types.UntypedNil:
|
||||
return ast.NewIdent("nil"), true
|
||||
case t.Kind() == types.Invalid:
|
||||
return &ast.BasicLit{Kind: token.STRING, Value: `"invalid"`}, false
|
||||
default:
|
||||
panic(fmt.Sprintf("ZeroExpr for unexpected type %v", t))
|
||||
}
|
||||
|
||||
case *types.Pointer, *types.Slice, *types.Chan, *types.Map, *types.Signature:
|
||||
return ast.NewIdent("nil"), true
|
||||
|
||||
case *types.Interface:
|
||||
if !t.IsMethodSet() {
|
||||
return &ast.BasicLit{Kind: token.STRING, Value: `"invalid"`}, false
|
||||
}
|
||||
return ast.NewIdent("nil"), true
|
||||
|
||||
case *types.Named:
|
||||
switch under := t.Underlying().(type) {
|
||||
case *types.Struct, *types.Array:
|
||||
return &ast.CompositeLit{
|
||||
Type: TypeExpr(t, qual),
|
||||
}, true
|
||||
default:
|
||||
return ZeroExpr(under, qual)
|
||||
}
|
||||
|
||||
case *types.Alias:
|
||||
switch t.Underlying().(type) {
|
||||
case *types.Struct, *types.Array:
|
||||
return &ast.CompositeLit{
|
||||
Type: TypeExpr(t, qual),
|
||||
}, true
|
||||
default:
|
||||
return ZeroExpr(types.Unalias(t), qual)
|
||||
}
|
||||
|
||||
case *types.Array, *types.Struct:
|
||||
return &ast.CompositeLit{
|
||||
Type: TypeExpr(t, qual),
|
||||
}, true
|
||||
|
||||
case *types.TypeParam:
|
||||
return &ast.StarExpr{ // *new(T)
|
||||
X: &ast.CallExpr{
|
||||
// Assumes func new is not shadowed.
|
||||
Fun: ast.NewIdent("new"),
|
||||
Args: []ast.Expr{
|
||||
ast.NewIdent(t.Obj().Name()),
|
||||
},
|
||||
},
|
||||
}, true
|
||||
|
||||
case *types.Tuple:
|
||||
// Unlike ZeroString, there is no ast.Expr can express tuple by
|
||||
// "(t[0], ..., t[n])".
|
||||
panic(fmt.Sprintf("invalid type for a variable: %v", t))
|
||||
|
||||
case *types.Union:
|
||||
// Variables of these types cannot be created, so it makes
|
||||
// no sense to ask for their zero value.
|
||||
panic(fmt.Sprintf("invalid type for a variable: %v", t))
|
||||
|
||||
default:
|
||||
panic(t) // unreachable.
|
||||
}
|
||||
}
|
||||
|
||||
// IsZeroExpr uses simple syntactic heuristics to report whether expr
|
||||
// is a obvious zero value, such as 0, "", nil, or false.
|
||||
// It cannot do better without type information.
|
||||
func IsZeroExpr(expr ast.Expr) bool {
|
||||
switch e := expr.(type) {
|
||||
case *ast.BasicLit:
|
||||
return e.Value == "0" || e.Value == `""`
|
||||
case *ast.Ident:
|
||||
return e.Name == "nil" || e.Name == "false"
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// TypeExpr returns syntax for the specified type. References to named types
|
||||
// are qualified by an appropriate (optional) qualifier function.
|
||||
// It may panic for types such as Tuple or Union.
|
||||
func TypeExpr(t types.Type, qual types.Qualifier) ast.Expr {
|
||||
switch t := t.(type) {
|
||||
case *types.Basic:
|
||||
switch t.Kind() {
|
||||
case types.UnsafePointer:
|
||||
return &ast.SelectorExpr{X: ast.NewIdent(qual(types.NewPackage("unsafe", "unsafe"))), Sel: ast.NewIdent("Pointer")}
|
||||
default:
|
||||
return ast.NewIdent(t.Name())
|
||||
}
|
||||
|
||||
case *types.Pointer:
|
||||
return &ast.UnaryExpr{
|
||||
Op: token.MUL,
|
||||
X: TypeExpr(t.Elem(), qual),
|
||||
}
|
||||
|
||||
case *types.Array:
|
||||
return &ast.ArrayType{
|
||||
Len: &ast.BasicLit{
|
||||
Kind: token.INT,
|
||||
Value: fmt.Sprintf("%d", t.Len()),
|
||||
},
|
||||
Elt: TypeExpr(t.Elem(), qual),
|
||||
}
|
||||
|
||||
case *types.Slice:
|
||||
return &ast.ArrayType{
|
||||
Elt: TypeExpr(t.Elem(), qual),
|
||||
}
|
||||
|
||||
case *types.Map:
|
||||
return &ast.MapType{
|
||||
Key: TypeExpr(t.Key(), qual),
|
||||
Value: TypeExpr(t.Elem(), qual),
|
||||
}
|
||||
|
||||
case *types.Chan:
|
||||
dir := ast.ChanDir(t.Dir())
|
||||
if t.Dir() == types.SendRecv {
|
||||
dir = ast.SEND | ast.RECV
|
||||
}
|
||||
return &ast.ChanType{
|
||||
Dir: dir,
|
||||
Value: TypeExpr(t.Elem(), qual),
|
||||
}
|
||||
|
||||
case *types.Signature:
|
||||
var params []*ast.Field
|
||||
for i := 0; i < t.Params().Len(); i++ {
|
||||
params = append(params, &ast.Field{
|
||||
Type: TypeExpr(t.Params().At(i).Type(), qual),
|
||||
Names: []*ast.Ident{
|
||||
{
|
||||
Name: t.Params().At(i).Name(),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
if t.Variadic() {
|
||||
last := params[len(params)-1]
|
||||
last.Type = &ast.Ellipsis{Elt: last.Type.(*ast.ArrayType).Elt}
|
||||
}
|
||||
var returns []*ast.Field
|
||||
for i := 0; i < t.Results().Len(); i++ {
|
||||
returns = append(returns, &ast.Field{
|
||||
Type: TypeExpr(t.Results().At(i).Type(), qual),
|
||||
})
|
||||
}
|
||||
return &ast.FuncType{
|
||||
Params: &ast.FieldList{
|
||||
List: params,
|
||||
},
|
||||
Results: &ast.FieldList{
|
||||
List: returns,
|
||||
},
|
||||
}
|
||||
|
||||
case *types.TypeParam:
|
||||
pkgName := qual(t.Obj().Pkg())
|
||||
if pkgName == "" || t.Obj().Pkg() == nil {
|
||||
return ast.NewIdent(t.Obj().Name())
|
||||
}
|
||||
return &ast.SelectorExpr{
|
||||
X: ast.NewIdent(pkgName),
|
||||
Sel: ast.NewIdent(t.Obj().Name()),
|
||||
}
|
||||
|
||||
// types.TypeParam also implements interface NamedOrAlias. To differentiate,
|
||||
// case TypeParam need to be present before case NamedOrAlias.
|
||||
// TODO(hxjiang): remove this comment once TypeArgs() is added to interface
|
||||
// NamedOrAlias.
|
||||
case NamedOrAlias:
|
||||
var expr ast.Expr = ast.NewIdent(t.Obj().Name())
|
||||
if pkgName := qual(t.Obj().Pkg()); pkgName != "." && pkgName != "" {
|
||||
expr = &ast.SelectorExpr{
|
||||
X: ast.NewIdent(pkgName),
|
||||
Sel: expr.(*ast.Ident),
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(hxjiang): call t.TypeArgs after adding method TypeArgs() to
|
||||
// typesinternal.NamedOrAlias.
|
||||
if hasTypeArgs, ok := t.(interface{ TypeArgs() *types.TypeList }); ok {
|
||||
if typeArgs := hasTypeArgs.TypeArgs(); typeArgs != nil && typeArgs.Len() > 0 {
|
||||
var indices []ast.Expr
|
||||
for i := range typeArgs.Len() {
|
||||
indices = append(indices, TypeExpr(typeArgs.At(i), qual))
|
||||
}
|
||||
expr = &ast.IndexListExpr{
|
||||
X: expr,
|
||||
Indices: indices,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return expr
|
||||
|
||||
case *types.Struct:
|
||||
return ast.NewIdent(t.String())
|
||||
|
||||
case *types.Interface:
|
||||
return ast.NewIdent(t.String())
|
||||
|
||||
case *types.Union:
|
||||
if t.Len() == 0 {
|
||||
panic("Union type should have at least one term")
|
||||
}
|
||||
// Same as go/ast, the return expression will put last term in the
|
||||
// Y field at topmost level of BinaryExpr.
|
||||
// For union of type "float32 | float64 | int64", the structure looks
|
||||
// similar to:
|
||||
// {
|
||||
// X: {
|
||||
// X: float32,
|
||||
// Op: |
|
||||
// Y: float64,
|
||||
// }
|
||||
// Op: |,
|
||||
// Y: int64,
|
||||
// }
|
||||
var union ast.Expr
|
||||
for i := range t.Len() {
|
||||
term := t.Term(i)
|
||||
termExpr := TypeExpr(term.Type(), qual)
|
||||
if term.Tilde() {
|
||||
termExpr = &ast.UnaryExpr{
|
||||
Op: token.TILDE,
|
||||
X: termExpr,
|
||||
}
|
||||
}
|
||||
if i == 0 {
|
||||
union = termExpr
|
||||
} else {
|
||||
union = &ast.BinaryExpr{
|
||||
X: union,
|
||||
Op: token.OR,
|
||||
Y: termExpr,
|
||||
}
|
||||
}
|
||||
}
|
||||
return union
|
||||
|
||||
case *types.Tuple:
|
||||
panic("invalid input type types.Tuple")
|
||||
|
||||
default:
|
||||
panic("unreachable")
|
||||
}
|
||||
}
|
13
vendor/golang.org/x/tools/internal/versions/constraint.go
generated
vendored
13
vendor/golang.org/x/tools/internal/versions/constraint.go
generated
vendored
@ -1,13 +0,0 @@
|
||||
// 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
14
vendor/golang.org/x/tools/internal/versions/constraint_go121.go
generated
vendored
@ -1,14 +0,0 @@
|
||||
// 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
|
||||
}
|
Reference in New Issue
Block a user