vendor: golang.org/x/tools v0.1.5

full diff: https://github.com/golang/tools/compare/v0.1.0...v0.1.5

It's not used, but one of our dependencies has a `tools.go` file that forces
it to be vendored; vendor/cloud.google.com/go/tools.go

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-02-23 18:42:17 +01:00
parent 1b829c2a6a
commit 7876c53424
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
25 changed files with 656 additions and 73 deletions

View file

@ -140,7 +140,7 @@ require (
golang.org/x/mod v0.4.2 // indirect
golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/tools v0.1.0 // indirect
golang.org/x/tools v0.1.5 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/api v0.46.0 // indirect
google.golang.org/appengine v1.6.7 // indirect

View file

@ -876,7 +876,6 @@ golang.org/x/sys v0.0.0-20201117170446-d9b008d0a637/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210313202042-bd2e13477e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@ -928,8 +927,8 @@ golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roY
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200622203043-20e05c1c8ffa/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View file

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build gc
// +build gc
package main

View file

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !gc
// +build !gc
package main

View file

@ -9,6 +9,8 @@ import (
"go/ast"
"reflect"
"sort"
"golang.org/x/tools/internal/typeparams"
)
// An ApplyFunc is invoked by Apply for each node n, even if n is nil,
@ -437,7 +439,11 @@ func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast.
}
default:
panic(fmt.Sprintf("Apply: unexpected node type %T", n))
if typeparams.IsListExpr(n) {
a.applyList(n, "ElemList")
} else {
panic(fmt.Sprintf("Apply: unexpected node type %T", n))
}
}
if a.post != nil && !a.post(&a.cursor) {

View file

@ -100,10 +100,34 @@ func Read(in io.Reader, fset *token.FileSet, imports map[string]*types.Package,
// Write writes encoded type information for the specified package to out.
// The FileSet provides file position information for named objects.
func Write(out io.Writer, fset *token.FileSet, pkg *types.Package) error {
b, err := gcimporter.IExportData(fset, pkg)
if err != nil {
if _, err := io.WriteString(out, "i"); err != nil {
return err
}
_, err = out.Write(b)
return err
return gcimporter.IExportData(out, fset, pkg)
}
// ReadBundle reads an export bundle from in, decodes it, and returns type
// information for the packages.
// File position information is added to fset.
//
// ReadBundle may inspect and add to the imports map to ensure that references
// within the export bundle to other packages are consistent.
//
// On return, the state of the reader is undefined.
//
// Experimental: This API is experimental and may change in the future.
func ReadBundle(in io.Reader, fset *token.FileSet, imports map[string]*types.Package) ([]*types.Package, error) {
data, err := ioutil.ReadAll(in)
if err != nil {
return nil, fmt.Errorf("reading export bundle: %v", err)
}
return gcimporter.IImportBundle(fset, imports, data)
}
// WriteBundle writes encoded type information for the specified packages to out.
// The FileSet provides file position information for named objects.
//
// Experimental: This API is experimental and may change in the future.
func WriteBundle(out io.Writer, fset *token.FileSet, pkgs []*types.Package) error {
return gcimporter.IExportBundle(out, fset, pkgs)
}

View file

@ -25,12 +25,25 @@ import (
// 0: Go1.11 encoding
const iexportVersion = 0
// IExportData returns the binary export data for pkg.
// Current bundled export format version. Increase with each format change.
// 0: initial implementation
const bundleVersion = 0
// IExportData writes indexed export data for pkg to out.
//
// If no file set is provided, position info will be missing.
// The package path of the top-level package will not be recorded,
// so that calls to IImportData can override with a provided package path.
func IExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error) {
func IExportData(out io.Writer, fset *token.FileSet, pkg *types.Package) error {
return iexportCommon(out, fset, false, []*types.Package{pkg})
}
// IExportBundle writes an indexed export bundle for pkgs to out.
func IExportBundle(out io.Writer, fset *token.FileSet, pkgs []*types.Package) error {
return iexportCommon(out, fset, true, pkgs)
}
func iexportCommon(out io.Writer, fset *token.FileSet, bundle bool, pkgs []*types.Package) (err error) {
defer func() {
if e := recover(); e != nil {
if ierr, ok := e.(internalError); ok {
@ -43,13 +56,14 @@ func IExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error)
}()
p := iexporter{
out: bytes.NewBuffer(nil),
fset: fset,
allPkgs: map[*types.Package]bool{},
stringIndex: map[string]uint64{},
declIndex: map[types.Object]uint64{},
typIndex: map[types.Type]uint64{},
localpkg: pkg,
}
if !bundle {
p.localpkg = pkgs[0]
}
for i, pt := range predeclared() {
@ -60,10 +74,20 @@ func IExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error)
}
// Initialize work queue with exported declarations.
scope := pkg.Scope()
for _, name := range scope.Names() {
if ast.IsExported(name) {
p.pushDecl(scope.Lookup(name))
for _, pkg := range pkgs {
scope := pkg.Scope()
for _, name := range scope.Names() {
if ast.IsExported(name) {
p.pushDecl(scope.Lookup(name))
}
}
if bundle {
// Ensure pkg and its imports are included in the index.
p.allPkgs[pkg] = true
for _, imp := range pkg.Imports() {
p.allPkgs[imp] = true
}
}
}
@ -76,21 +100,35 @@ func IExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error)
dataLen := uint64(p.data0.Len())
w := p.newWriter()
w.writeIndex(p.declIndex)
if bundle {
w.uint64(uint64(len(pkgs)))
for _, pkg := range pkgs {
w.pkg(pkg)
imps := pkg.Imports()
w.uint64(uint64(len(imps)))
for _, imp := range imps {
w.pkg(imp)
}
}
}
w.flush()
// Assemble header.
var hdr intWriter
hdr.WriteByte('i')
if bundle {
hdr.uint64(bundleVersion)
}
hdr.uint64(iexportVersion)
hdr.uint64(uint64(p.strings.Len()))
hdr.uint64(dataLen)
// Flush output.
io.Copy(p.out, &hdr)
io.Copy(p.out, &p.strings)
io.Copy(p.out, &p.data0)
io.Copy(out, &hdr)
io.Copy(out, &p.strings)
io.Copy(out, &p.data0)
return p.out.Bytes(), nil
return nil
}
// writeIndex writes out an object index. mainIndex indicates whether
@ -104,7 +142,9 @@ func (w *exportWriter) writeIndex(index map[types.Object]uint64) {
// For the main index, make sure to include every package that
// we reference, even if we're not exporting (or reexporting)
// any symbols from it.
pkgObjs[w.p.localpkg] = nil
if w.p.localpkg != nil {
pkgObjs[w.p.localpkg] = nil
}
for pkg := range w.p.allPkgs {
pkgObjs[pkg] = nil
}
@ -474,10 +514,10 @@ func (w *exportWriter) param(obj types.Object) {
func (w *exportWriter) value(typ types.Type, v constant.Value) {
w.typ(typ, nil)
switch v.Kind() {
case constant.Bool:
switch b := typ.Underlying().(*types.Basic); b.Info() & types.IsConstType {
case types.IsBoolean:
w.bool(constant.BoolVal(v))
case constant.Int:
case types.IsInteger:
var i big.Int
if i64, exact := constant.Int64Val(v); exact {
i.SetInt64(i64)
@ -487,25 +527,27 @@ func (w *exportWriter) value(typ types.Type, v constant.Value) {
i.SetString(v.ExactString(), 10)
}
w.mpint(&i, typ)
case constant.Float:
case types.IsFloat:
f := constantToFloat(v)
w.mpfloat(f, typ)
case constant.Complex:
case types.IsComplex:
w.mpfloat(constantToFloat(constant.Real(v)), typ)
w.mpfloat(constantToFloat(constant.Imag(v)), typ)
case constant.String:
case types.IsString:
w.string(constant.StringVal(v))
case constant.Unknown:
// package contains type errors
default:
panic(internalErrorf("unexpected value %v (%T)", v, v))
if b.Kind() == types.Invalid {
// package contains type errors
break
}
panic(internalErrorf("unexpected type %v (%v)", typ, typ.Underlying()))
}
}
// constantToFloat converts a constant.Value with kind constant.Float to a
// big.Float.
func constantToFloat(x constant.Value) *big.Float {
assert(x.Kind() == constant.Float)
x = constant.ToFloat(x)
// Use the same floating-point precision (512) as cmd/compile
// (see Mpprec in cmd/compile/internal/gc/mpfloat.go).
const mpprec = 512

View file

@ -59,10 +59,23 @@ const (
)
// IImportData imports a package from the serialized package data
// and returns the number of bytes consumed and a reference to the package.
// and returns 0 and a reference to the package.
// If the export data version is not recognized or the format is otherwise
// compromised, an error is returned.
func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (_ int, pkg *types.Package, err error) {
func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (int, *types.Package, error) {
pkgs, err := iimportCommon(fset, imports, data, false, path)
if err != nil {
return 0, nil, err
}
return 0, pkgs[0], nil
}
// IImportBundle imports a set of packages from the serialized package bundle.
func IImportBundle(fset *token.FileSet, imports map[string]*types.Package, data []byte) ([]*types.Package, error) {
return iimportCommon(fset, imports, data, true, "")
}
func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data []byte, bundle bool, path string) (pkgs []*types.Package, err error) {
const currentVersion = 1
version := int64(-1)
defer func() {
@ -77,6 +90,15 @@ func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []
r := &intReader{bytes.NewReader(data), path}
if bundle {
bundleVersion := r.uint64()
switch bundleVersion {
case bundleVersion:
default:
errorf("unknown bundle format version %d", bundleVersion)
}
}
version = int64(r.uint64())
switch version {
case currentVersion, 0:
@ -143,39 +165,58 @@ func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []
p.pkgIndex[pkg] = nameIndex
pkgList[i] = pkg
}
if len(pkgList) == 0 {
errorf("no packages found for %s", path)
panic("unreachable")
if bundle {
pkgs = make([]*types.Package, r.uint64())
for i := range pkgs {
pkg := p.pkgAt(r.uint64())
imps := make([]*types.Package, r.uint64())
for j := range imps {
imps[j] = p.pkgAt(r.uint64())
}
pkg.SetImports(imps)
pkgs[i] = pkg
}
} else {
if len(pkgList) == 0 {
errorf("no packages found for %s", path)
panic("unreachable")
}
pkgs = pkgList[:1]
// record all referenced packages as imports
list := append(([]*types.Package)(nil), pkgList[1:]...)
sort.Sort(byPath(list))
pkgs[0].SetImports(list)
}
p.ipkg = pkgList[0]
names := make([]string, 0, len(p.pkgIndex[p.ipkg]))
for name := range p.pkgIndex[p.ipkg] {
names = append(names, name)
}
sort.Strings(names)
for _, name := range names {
p.doDecl(p.ipkg, name)
for _, pkg := range pkgs {
if pkg.Complete() {
continue
}
names := make([]string, 0, len(p.pkgIndex[pkg]))
for name := range p.pkgIndex[pkg] {
names = append(names, name)
}
sort.Strings(names)
for _, name := range names {
p.doDecl(pkg, name)
}
// package was imported completely and without errors
pkg.MarkComplete()
}
for _, typ := range p.interfaceList {
typ.Complete()
}
// record all referenced packages as imports
list := append(([]*types.Package)(nil), pkgList[1:]...)
sort.Sort(byPath(list))
p.ipkg.SetImports(list)
// package was imported completely and without errors
p.ipkg.MarkComplete()
consumed, _ := r.Seek(0, io.SeekCurrent)
return int(consumed), p.ipkg, nil
return pkgs, nil
}
type iimporter struct {
ipath string
ipkg *types.Package
version int
stringData []byte
@ -227,9 +268,6 @@ func (p *iimporter) pkgAt(off uint64) *types.Package {
return pkg
}
path := p.stringAt(off)
if path == p.ipath {
return p.ipkg
}
errorf("missing package %q in %q", path, p.ipath)
return nil
}
@ -435,6 +473,14 @@ func (r *importReader) mpfloat(b *types.Basic) constant.Value {
switch {
case exp > 0:
x = constant.Shift(x, token.SHL, uint(exp))
// Ensure that the imported Kind is Float, else this constant may run into
// bitsize limits on overlarge integers. Eventually we can instead adopt
// the approach of CL 288632, but that CL relies on go/constant APIs that
// were introduced in go1.13.
//
// TODO(rFindley): sync the logic here with tip Go once we no longer
// support go1.12.
x = constant.ToFloat(x)
case exp < 0:
d := constant.Shift(constant.MakeInt64(1), token.SHL, uint(-exp))
x = constant.BinaryOp(x, token.QUO, d)

View file

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !go1.11
// +build !go1.11
package gcimporter

View file

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build go1.11
// +build go1.11
package gcimporter

View file

@ -96,6 +96,8 @@ func Of64(k Key, v uint64) Label { return Label{key: k, packed: v} }
// access should be done with the From method of the key.
func (t Label) Unpack64() uint64 { return t.packed }
type stringptr unsafe.Pointer
// OfString creates a new label from a key and a string.
// This method is for implementing new key types, label creation should
// normally be done with the Of method of the key.
@ -104,7 +106,7 @@ func OfString(k Key, v string) Label {
return Label{
key: k,
packed: uint64(hdr.Len),
untyped: unsafe.Pointer(hdr.Data),
untyped: stringptr(hdr.Data),
}
}
@ -115,9 +117,9 @@ func OfString(k Key, v string) Label {
func (t Label) UnpackString() string {
var v string
hdr := (*reflect.StringHeader)(unsafe.Pointer(&v))
hdr.Data = uintptr(t.untyped.(unsafe.Pointer))
hdr.Data = uintptr(t.untyped.(stringptr))
hdr.Len = int(t.packed)
return *(*string)(unsafe.Pointer(hdr))
return v
}
// Valid returns true if the Label is a valid one (it has a key).

View file

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build freebsd || openbsd || netbsd
// +build freebsd openbsd netbsd
package fastwalk

View file

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build (linux || darwin) && !appengine
// +build linux darwin
// +build !appengine

View file

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build darwin || freebsd || openbsd || netbsd
// +build darwin freebsd openbsd netbsd
package fastwalk

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build linux
// +build !appengine
//go:build linux && !appengine
// +build linux,!appengine
package fastwalk

View file

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build appengine || (!linux && !darwin && !freebsd && !openbsd && !netbsd)
// +build appengine !linux,!darwin,!freebsd,!openbsd,!netbsd
package fastwalk

View file

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build (linux || darwin || freebsd || openbsd || netbsd) && !appengine
// +build linux darwin freebsd openbsd netbsd
// +build !appengine
@ -21,7 +22,7 @@ const blockSize = 8 << 10
const unknownFileMode os.FileMode = os.ModeNamedPipe | os.ModeSocket | os.ModeDevice
func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) error) error {
fd, err := syscall.Open(dirName, 0, 0)
fd, err := open(dirName, 0, 0)
if err != nil {
return &os.PathError{Op: "open", Path: dirName, Err: err}
}
@ -35,7 +36,7 @@ func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) e
for {
if bufp >= nbuf {
bufp = 0
nbuf, err = syscall.ReadDirent(fd, buf)
nbuf, err = readDirent(fd, buf)
if err != nil {
return os.NewSyscallError("readdirent", err)
}
@ -126,3 +127,27 @@ func parseDirEnt(buf []byte) (consumed int, name string, typ os.FileMode) {
}
return
}
// According to https://golang.org/doc/go1.14#runtime
// A consequence of the implementation of preemption is that on Unix systems, including Linux and macOS
// systems, programs built with Go 1.14 will receive more signals than programs built with earlier releases.
//
// This causes syscall.Open and syscall.ReadDirent sometimes fail with EINTR errors.
// We need to retry in this case.
func open(path string, mode int, perm uint32) (fd int, err error) {
for {
fd, err := syscall.Open(path, mode, perm)
if err != syscall.EINTR {
return fd, err
}
}
}
func readDirent(fd int, buf []byte) (n int, err error) {
for {
nbuf, err := syscall.ReadDirent(fd, buf)
if err != syscall.EINTR {
return nbuf, err
}
}
}

View file

@ -12,6 +12,7 @@ import (
"path/filepath"
"regexp"
"strings"
"time"
"golang.org/x/mod/semver"
)
@ -19,11 +20,15 @@ import (
// ModuleJSON holds information about a module.
type ModuleJSON struct {
Path string // module path
Version string // module version
Versions []string // available module versions (with -versions)
Replace *ModuleJSON // replaced by this module
Time *time.Time // time version was created
Update *ModuleJSON // available update, if any (with -u)
Main bool // is this the main module?
Indirect bool // is this module only an indirect dependency of main module?
Dir string // directory holding files for this module, if any
GoMod string // path to go.mod file for this module, if any
GoMod string // path to go.mod file used when loading this module, if any
GoVersion string // go version used in module
}

View file

@ -14,7 +14,7 @@ import (
// It returns the X in Go 1.X.
func GoVersion(ctx context.Context, inv Invocation, r *Runner) (int, error) {
inv.Verb = "list"
inv.Args = []string{"-e", "-f", `{{context.ReleaseTags}}`}
inv.Args = []string{"-e", "-f", `{{context.ReleaseTags}}`, `--`, `unsafe`}
inv.Env = append(append([]string{}, inv.Env...), "GO111MODULE=off")
// Unset any unneeded flags, and remove them from BuildFlags, if they're
// present.

View file

@ -89,8 +89,10 @@ func (r *ModuleResolver) init() error {
err := r.initAllMods()
// We expect an error when running outside of a module with
// GO111MODULE=on. Other errors are fatal.
if err != nil && !strings.Contains(err.Error(), "working directory is not part of a module") {
return err
if err != nil {
if errMsg := err.Error(); !strings.Contains(errMsg, "working directory is not part of a module") && !strings.Contains(errMsg, "go.mod file not found") {
return err
}
}
}

View file

@ -974,13 +974,29 @@ var stdlib = map[string][]string{
"DF_STATIC_TLS",
"DF_SYMBOLIC",
"DF_TEXTREL",
"DT_ADDRRNGHI",
"DT_ADDRRNGLO",
"DT_AUDIT",
"DT_AUXILIARY",
"DT_BIND_NOW",
"DT_CHECKSUM",
"DT_CONFIG",
"DT_DEBUG",
"DT_DEPAUDIT",
"DT_ENCODING",
"DT_FEATURE",
"DT_FILTER",
"DT_FINI",
"DT_FINI_ARRAY",
"DT_FINI_ARRAYSZ",
"DT_FLAGS",
"DT_FLAGS_1",
"DT_GNU_CONFLICT",
"DT_GNU_CONFLICTSZ",
"DT_GNU_HASH",
"DT_GNU_LIBLIST",
"DT_GNU_LIBLISTSZ",
"DT_GNU_PRELINKED",
"DT_HASH",
"DT_HIOS",
"DT_HIPROC",
@ -990,28 +1006,100 @@ var stdlib = map[string][]string{
"DT_JMPREL",
"DT_LOOS",
"DT_LOPROC",
"DT_MIPS_AUX_DYNAMIC",
"DT_MIPS_BASE_ADDRESS",
"DT_MIPS_COMPACT_SIZE",
"DT_MIPS_CONFLICT",
"DT_MIPS_CONFLICTNO",
"DT_MIPS_CXX_FLAGS",
"DT_MIPS_DELTA_CLASS",
"DT_MIPS_DELTA_CLASSSYM",
"DT_MIPS_DELTA_CLASSSYM_NO",
"DT_MIPS_DELTA_CLASS_NO",
"DT_MIPS_DELTA_INSTANCE",
"DT_MIPS_DELTA_INSTANCE_NO",
"DT_MIPS_DELTA_RELOC",
"DT_MIPS_DELTA_RELOC_NO",
"DT_MIPS_DELTA_SYM",
"DT_MIPS_DELTA_SYM_NO",
"DT_MIPS_DYNSTR_ALIGN",
"DT_MIPS_FLAGS",
"DT_MIPS_GOTSYM",
"DT_MIPS_GP_VALUE",
"DT_MIPS_HIDDEN_GOTIDX",
"DT_MIPS_HIPAGENO",
"DT_MIPS_ICHECKSUM",
"DT_MIPS_INTERFACE",
"DT_MIPS_INTERFACE_SIZE",
"DT_MIPS_IVERSION",
"DT_MIPS_LIBLIST",
"DT_MIPS_LIBLISTNO",
"DT_MIPS_LOCALPAGE_GOTIDX",
"DT_MIPS_LOCAL_GOTIDX",
"DT_MIPS_LOCAL_GOTNO",
"DT_MIPS_MSYM",
"DT_MIPS_OPTIONS",
"DT_MIPS_PERF_SUFFIX",
"DT_MIPS_PIXIE_INIT",
"DT_MIPS_PLTGOT",
"DT_MIPS_PROTECTED_GOTIDX",
"DT_MIPS_RLD_MAP",
"DT_MIPS_RLD_MAP_REL",
"DT_MIPS_RLD_TEXT_RESOLVE_ADDR",
"DT_MIPS_RLD_VERSION",
"DT_MIPS_RWPLT",
"DT_MIPS_SYMBOL_LIB",
"DT_MIPS_SYMTABNO",
"DT_MIPS_TIME_STAMP",
"DT_MIPS_UNREFEXTNO",
"DT_MOVEENT",
"DT_MOVESZ",
"DT_MOVETAB",
"DT_NEEDED",
"DT_NULL",
"DT_PLTGOT",
"DT_PLTPAD",
"DT_PLTPADSZ",
"DT_PLTREL",
"DT_PLTRELSZ",
"DT_POSFLAG_1",
"DT_PPC64_GLINK",
"DT_PPC64_OPD",
"DT_PPC64_OPDSZ",
"DT_PPC64_OPT",
"DT_PPC_GOT",
"DT_PPC_OPT",
"DT_PREINIT_ARRAY",
"DT_PREINIT_ARRAYSZ",
"DT_REL",
"DT_RELA",
"DT_RELACOUNT",
"DT_RELAENT",
"DT_RELASZ",
"DT_RELCOUNT",
"DT_RELENT",
"DT_RELSZ",
"DT_RPATH",
"DT_RUNPATH",
"DT_SONAME",
"DT_SPARC_REGISTER",
"DT_STRSZ",
"DT_STRTAB",
"DT_SYMBOLIC",
"DT_SYMENT",
"DT_SYMINENT",
"DT_SYMINFO",
"DT_SYMINSZ",
"DT_SYMTAB",
"DT_SYMTAB_SHNDX",
"DT_TEXTREL",
"DT_TLSDESC_GOT",
"DT_TLSDESC_PLT",
"DT_USED",
"DT_VALRNGHI",
"DT_VALRNGLO",
"DT_VERDEF",
"DT_VERDEFNUM",
"DT_VERNEED",
"DT_VERNEEDNUM",
"DT_VERSYM",
@ -1271,17 +1359,38 @@ var stdlib = map[string][]string{
"PF_R",
"PF_W",
"PF_X",
"PT_AARCH64_ARCHEXT",
"PT_AARCH64_UNWIND",
"PT_ARM_ARCHEXT",
"PT_ARM_EXIDX",
"PT_DYNAMIC",
"PT_GNU_EH_FRAME",
"PT_GNU_MBIND_HI",
"PT_GNU_MBIND_LO",
"PT_GNU_PROPERTY",
"PT_GNU_RELRO",
"PT_GNU_STACK",
"PT_HIOS",
"PT_HIPROC",
"PT_INTERP",
"PT_LOAD",
"PT_LOOS",
"PT_LOPROC",
"PT_MIPS_ABIFLAGS",
"PT_MIPS_OPTIONS",
"PT_MIPS_REGINFO",
"PT_MIPS_RTPROC",
"PT_NOTE",
"PT_NULL",
"PT_OPENBSD_BOOTDATA",
"PT_OPENBSD_RANDOMIZE",
"PT_OPENBSD_WXNEEDED",
"PT_PAX_FLAGS",
"PT_PHDR",
"PT_S390_PGSTE",
"PT_SHLIB",
"PT_SUNWSTACK",
"PT_SUNW_EH_FRAME",
"PT_TLS",
"Prog",
"Prog32",
@ -2445,6 +2554,9 @@ var stdlib = map[string][]string{
"SectionHeader",
"Sym",
},
"embed": []string{
"FS",
},
"encoding": []string{
"BinaryMarshaler",
"BinaryUnmarshaler",
@ -2680,6 +2792,7 @@ var stdlib = map[string][]string{
"FlagSet",
"Float64",
"Float64Var",
"Func",
"Getter",
"Int",
"Int64",
@ -2853,6 +2966,18 @@ var stdlib = map[string][]string{
"Package",
"ToolDir",
},
"go/build/constraint": []string{
"AndExpr",
"Expr",
"IsGoBuild",
"IsPlusBuild",
"NotExpr",
"OrExpr",
"Parse",
"PlusBuildLines",
"SyntaxError",
"TagExpr",
},
"go/constant": []string{
"BinaryOp",
"BitLen",
@ -3273,6 +3398,7 @@ var stdlib = map[string][]string{
"Must",
"New",
"OK",
"ParseFS",
"ParseFiles",
"ParseGlob",
"Srcset",
@ -3432,6 +3558,7 @@ var stdlib = map[string][]string{
"Copy",
"CopyBuffer",
"CopyN",
"Discard",
"EOF",
"ErrClosedPipe",
"ErrNoProgress",
@ -3443,12 +3570,15 @@ var stdlib = map[string][]string{
"MultiReader",
"MultiWriter",
"NewSectionReader",
"NopCloser",
"Pipe",
"PipeReader",
"PipeWriter",
"ReadAll",
"ReadAtLeast",
"ReadCloser",
"ReadFull",
"ReadSeekCloser",
"ReadSeeker",
"ReadWriteCloser",
"ReadWriteSeeker",
@ -3472,6 +3602,49 @@ var stdlib = map[string][]string{
"WriterAt",
"WriterTo",
},
"io/fs": []string{
"DirEntry",
"ErrClosed",
"ErrExist",
"ErrInvalid",
"ErrNotExist",
"ErrPermission",
"FS",
"File",
"FileInfo",
"FileMode",
"Glob",
"GlobFS",
"ModeAppend",
"ModeCharDevice",
"ModeDevice",
"ModeDir",
"ModeExclusive",
"ModeIrregular",
"ModeNamedPipe",
"ModePerm",
"ModeSetgid",
"ModeSetuid",
"ModeSocket",
"ModeSticky",
"ModeSymlink",
"ModeTemporary",
"ModeType",
"PathError",
"ReadDir",
"ReadDirFS",
"ReadDirFile",
"ReadFile",
"ReadFileFS",
"SkipDir",
"Stat",
"StatFS",
"Sub",
"SubFS",
"ValidPath",
"WalkDir",
"WalkDirFunc",
},
"io/ioutil": []string{
"Discard",
"NopCloser",
@ -3483,6 +3656,7 @@ var stdlib = map[string][]string{
"WriteFile",
},
"log": []string{
"Default",
"Fatal",
"Fatalf",
"Fatalln",
@ -3819,6 +3993,7 @@ var stdlib = map[string][]string{
"DialUDP",
"DialUnix",
"Dialer",
"ErrClosed",
"ErrWriteToConnected",
"Error",
"FileConn",
@ -3938,6 +4113,7 @@ var stdlib = map[string][]string{
"ErrUseLastResponse",
"ErrWriteAfterFlush",
"Error",
"FS",
"File",
"FileServer",
"FileSystem",
@ -4234,7 +4410,10 @@ var stdlib = map[string][]string{
"Chtimes",
"Clearenv",
"Create",
"CreateTemp",
"DevNull",
"DirEntry",
"DirFS",
"Environ",
"ErrClosed",
"ErrDeadlineExceeded",
@ -4243,6 +4422,7 @@ var stdlib = map[string][]string{
"ErrNoDeadline",
"ErrNotExist",
"ErrPermission",
"ErrProcessDone",
"Executable",
"Exit",
"Expand",
@ -4276,6 +4456,7 @@ var stdlib = map[string][]string{
"Lstat",
"Mkdir",
"MkdirAll",
"MkdirTemp",
"ModeAppend",
"ModeCharDevice",
"ModeDevice",
@ -4310,6 +4491,8 @@ var stdlib = map[string][]string{
"ProcAttr",
"Process",
"ProcessState",
"ReadDir",
"ReadFile",
"Readlink",
"Remove",
"RemoveAll",
@ -4333,6 +4516,7 @@ var stdlib = map[string][]string{
"UserCacheDir",
"UserConfigDir",
"UserHomeDir",
"WriteFile",
},
"os/exec": []string{
"Cmd",
@ -4347,6 +4531,7 @@ var stdlib = map[string][]string{
"Ignore",
"Ignored",
"Notify",
"NotifyContext",
"Reset",
"Stop",
},
@ -4397,6 +4582,7 @@ var stdlib = map[string][]string{
"ToSlash",
"VolumeName",
"Walk",
"WalkDir",
"WalkFunc",
},
"plugin": []string{
@ -4629,6 +4815,19 @@ var stdlib = map[string][]string{
"Stack",
"WriteHeapDump",
},
"runtime/metrics": []string{
"All",
"Description",
"Float64Histogram",
"KindBad",
"KindFloat64",
"KindFloat64Histogram",
"KindUint64",
"Read",
"Sample",
"Value",
"ValueKind",
},
"runtime/pprof": []string{
"Do",
"ForLabels",
@ -5012,6 +5211,8 @@ var stdlib = map[string][]string{
"AddrinfoW",
"Adjtime",
"Adjtimex",
"AllThreadsSyscall",
"AllThreadsSyscall6",
"AttachLsf",
"B0",
"B1000000",
@ -10010,13 +10211,20 @@ var stdlib = map[string][]string{
"TB",
"Verbose",
},
"testing/fstest": []string{
"MapFS",
"MapFile",
"TestFS",
},
"testing/iotest": []string{
"DataErrReader",
"ErrReader",
"ErrTimeout",
"HalfReader",
"NewReadLogger",
"NewWriteLogger",
"OneByteReader",
"TestReader",
"TimeoutReader",
"TruncateWriter",
},
@ -10076,6 +10284,7 @@ var stdlib = map[string][]string{
"JSEscaper",
"Must",
"New",
"ParseFS",
"ParseFiles",
"ParseGlob",
"Template",
@ -10087,12 +10296,14 @@ var stdlib = map[string][]string{
"BranchNode",
"ChainNode",
"CommandNode",
"CommentNode",
"DotNode",
"FieldNode",
"IdentifierNode",
"IfNode",
"IsEmptyTree",
"ListNode",
"Mode",
"New",
"NewIdentifier",
"NilNode",
@ -10101,6 +10312,7 @@ var stdlib = map[string][]string{
"NodeBool",
"NodeChain",
"NodeCommand",
"NodeComment",
"NodeDot",
"NodeField",
"NodeIdentifier",
@ -10118,6 +10330,7 @@ var stdlib = map[string][]string{
"NodeWith",
"NumberNode",
"Parse",
"ParseComments",
"PipeNode",
"Pos",
"RangeNode",
@ -10230,6 +10443,7 @@ var stdlib = map[string][]string{
"Chakma",
"Cham",
"Cherokee",
"Chorasmian",
"Co",
"Common",
"Coptic",
@ -10243,6 +10457,7 @@ var stdlib = map[string][]string{
"Devanagari",
"Diacritic",
"Digit",
"Dives_Akuru",
"Dogra",
"Duployan",
"Egyptian_Hieroglyphs",
@ -10300,6 +10515,7 @@ var stdlib = map[string][]string{
"Katakana",
"Kayah_Li",
"Kharoshthi",
"Khitan_Small_Script",
"Khmer",
"Khojki",
"Khudawadi",
@ -10472,6 +10688,7 @@ var stdlib = map[string][]string{
"Wancho",
"Warang_Citi",
"White_Space",
"Yezidi",
"Yi",
"Z",
"Zanabazar_Square",

11
vendor/golang.org/x/tools/internal/typeparams/doc.go generated vendored Normal file
View file

@ -0,0 +1,11 @@
// 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.
// Package typeparams provides functions to work indirectly with type parameter
// data stored in go/ast and go/types objects, while these API are guarded by a
// build constraint.
//
// This package exists to make it easier for tools to work with generic code,
// while also compiling against older Go versions.
package typeparams

View file

@ -0,0 +1,90 @@
// 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.
//go:build !typeparams || !go1.17
// +build !typeparams !go1.17
package typeparams
import (
"go/ast"
"go/types"
)
// NOTE: doc comments must be kept in sync with typeparams.go.
// Enabled reports whether type parameters are enabled in the current build
// environment.
const Enabled = false
// UnpackIndex extracts all index expressions from e. For non-generic code this
// is always one expression: e.Index, but may be more than one expression for
// generic type instantiation.
func UnpackIndex(e *ast.IndexExpr) []ast.Expr {
return []ast.Expr{e.Index}
}
// IsListExpr reports whether n is an *ast.ListExpr, which is a new node type
// introduced to hold type arguments for generic type instantiation.
func IsListExpr(n ast.Node) bool {
return false
}
// ForTypeDecl extracts the (possibly nil) type parameter node list from n.
func ForTypeDecl(*ast.TypeSpec) *ast.FieldList {
return nil
}
// ForFuncDecl extracts the (possibly nil) type parameter node list from n.
func ForFuncDecl(*ast.FuncDecl) *ast.FieldList {
return nil
}
// ForSignature extracts the (possibly empty) type parameter object list from
// sig.
func ForSignature(*types.Signature) []*types.TypeName {
return nil
}
// HasTypeSet reports if iface has a type set.
func HasTypeSet(*types.Interface) bool {
return false
}
// IsComparable reports if iface is the comparable interface.
func IsComparable(*types.Interface) bool {
return false
}
// IsConstraint reports whether iface may only be used as a type parameter
// constraint (i.e. has a type set or is the comparable interface).
func IsConstraint(*types.Interface) bool {
return false
}
// ForNamed extracts the (possibly empty) type parameter object list from
// named.
func ForNamed(*types.Named) []*types.TypeName {
return nil
}
// NamedTArgs extracts the (possibly empty) type argument list from named.
func NamedTArgs(*types.Named) []types.Type {
return nil
}
// InitInferred initializes info to record inferred type information.
func InitInferred(*types.Info) {
}
// GetInferred extracts inferred type information from info for e.
//
// The expression e may have an inferred type if it is an *ast.IndexExpr
// representing partial instantiation of a generic function type for which type
// arguments have been inferred using constraint type inference, or if it is an
// *ast.CallExpr for which type type arguments have be inferred using both
// constraint type inference and function argument inference.
func GetInferred(*types.Info, ast.Expr) ([]types.Type, *types.Signature) {
return nil, nil
}

View file

@ -0,0 +1,105 @@
// 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.
//go:build typeparams && go1.17
// +build typeparams,go1.17
package typeparams
import (
"go/ast"
"go/types"
)
// NOTE: doc comments must be kept in sync with notypeparams.go.
// Enabled reports whether type parameters are enabled in the current build
// environment.
const Enabled = true
// UnpackIndex extracts all index expressions from e. For non-generic code this
// is always one expression: e.Index, but may be more than one expression for
// generic type instantiation.
func UnpackIndex(e *ast.IndexExpr) []ast.Expr {
if x, _ := e.Index.(*ast.ListExpr); x != nil {
return x.ElemList
}
if e.Index != nil {
return []ast.Expr{e.Index}
}
return nil
}
// IsListExpr reports whether n is an *ast.ListExpr, which is a new node type
// introduced to hold type arguments for generic type instantiation.
func IsListExpr(n ast.Node) bool {
_, ok := n.(*ast.ListExpr)
return ok
}
// ForTypeDecl extracts the (possibly nil) type parameter node list from n.
func ForTypeDecl(n *ast.TypeSpec) *ast.FieldList {
return n.TParams
}
// ForFuncDecl extracts the (possibly nil) type parameter node list from n.
func ForFuncDecl(n *ast.FuncDecl) *ast.FieldList {
if n.Type != nil {
return n.Type.TParams
}
return nil
}
// ForSignature extracts the (possibly empty) type parameter object list from
// sig.
func ForSignature(sig *types.Signature) []*types.TypeName {
return sig.TParams()
}
// HasTypeSet reports if iface has a type set.
func HasTypeSet(iface *types.Interface) bool {
return iface.HasTypeList()
}
// IsComparable reports if iface is the comparable interface.
func IsComparable(iface *types.Interface) bool {
return iface.IsComparable()
}
// IsConstraint reports whether iface may only be used as a type parameter
// constraint (i.e. has a type set or is the comparable interface).
func IsConstraint(iface *types.Interface) bool {
return iface.IsConstraint()
}
// ForNamed extracts the (possibly empty) type parameter object list from
// named.
func ForNamed(named *types.Named) []*types.TypeName {
return named.TParams()
}
// NamedTArgs extracts the (possibly empty) type argument list from named.
func NamedTArgs(named *types.Named) []types.Type {
return named.TArgs()
}
// InitInferred initializes info to record inferred type information.
func InitInferred(info *types.Info) {
info.Inferred = make(map[ast.Expr]types.Inferred)
}
// GetInferred extracts inferred type information from info for e.
//
// The expression e may have an inferred type if it is an *ast.IndexExpr
// representing partial instantiation of a generic function type for which type
// arguments have been inferred using constraint type inference, or if it is an
// *ast.CallExpr for which type type arguments have be inferred using both
// constraint type inference and function argument inference.
func GetInferred(info *types.Info, e ast.Expr) ([]types.Type, *types.Signature) {
if info.Inferred == nil {
return nil, nil
}
inf := info.Inferred[e]
return inf.TArgs, inf.Sig
}

5
vendor/modules.txt vendored
View file

@ -864,8 +864,8 @@ golang.org/x/text/unicode/norm
# golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11
## explicit
golang.org/x/time/rate
# golang.org/x/tools v0.1.0
## explicit; go 1.12
# golang.org/x/tools v0.1.5
## explicit; go 1.17
golang.org/x/tools/cmd/goimports
golang.org/x/tools/go/ast/astutil
golang.org/x/tools/go/gcexportdata
@ -878,6 +878,7 @@ golang.org/x/tools/internal/fastwalk
golang.org/x/tools/internal/gocommand
golang.org/x/tools/internal/gopathwalk
golang.org/x/tools/internal/imports
golang.org/x/tools/internal/typeparams
# golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
## explicit; go 1.11
golang.org/x/xerrors