Bump viper version, fix nobrowser (#1991)

This commit is contained in:
kermieisinthehouse
2021-11-11 14:21:04 -08:00
committed by GitHub
parent 808202ba8a
commit a7ed0a7004
270 changed files with 12423 additions and 5794 deletions

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

@@ -22,7 +22,7 @@ func GetSizesGolist(ctx context.Context, inv gocommand.Invocation, gocmdRunner *
stdout, stderr, friendlyErr, rawErr := gocmdRunner.RunRaw(ctx, inv)
var goarch, compiler string
if rawErr != nil {
if strings.Contains(rawErr.Error(), "cannot find main module") {
if rawErrMsg := rawErr.Error(); strings.Contains(rawErrMsg, "cannot find main module") || strings.Contains(rawErrMsg, "go.mod file not found") {
// User's running outside of a module. All bets are off. Get GOARCH and guess compiler is gc.
// TODO(matloob): Is this a problem in practice?
inv.Verb = "env"

View File

@@ -10,7 +10,6 @@ import (
"encoding/json"
"fmt"
"go/types"
exec "golang.org/x/sys/execabs"
"io/ioutil"
"log"
"os"
@@ -23,8 +22,10 @@ import (
"sync"
"unicode"
exec "golang.org/x/sys/execabs"
"golang.org/x/tools/go/internal/packagesdriver"
"golang.org/x/tools/internal/gocommand"
"golang.org/x/tools/internal/packagesinternal"
"golang.org/x/xerrors"
)
@@ -413,7 +414,8 @@ type jsonPackage struct {
ForTest string // q in a "p [q.test]" package, else ""
DepOnly bool
Error *jsonPackageError
Error *packagesinternal.PackageError
DepsErrors []*packagesinternal.PackageError
}
type jsonPackageError struct {
@@ -565,6 +567,7 @@ func (state *golistState) createDriverResponse(words ...string) (*driverResponse
OtherFiles: absJoin(p.Dir, otherFiles(p)...),
IgnoredFiles: absJoin(p.Dir, p.IgnoredGoFiles, p.IgnoredOtherFiles),
forTest: p.ForTest,
depsErrors: p.DepsErrors,
Module: p.Module,
}
@@ -581,7 +584,7 @@ func (state *golistState) createDriverResponse(words ...string) (*driverResponse
// golang/go#38990: go list silently fails to do cgo processing
pkg.CompiledGoFiles = nil
pkg.Errors = append(pkg.Errors, Error{
Msg: "go list failed to return CompiledGoFiles; https://golang.org/issue/38990?",
Msg: "go list failed to return CompiledGoFiles. This may indicate failure to perform cgo processing; try building at the command line. See https://golang.org/issue/38990.",
Kind: ListError,
})
}
@@ -865,7 +868,7 @@ func (state *golistState) invokeGo(verb string, args ...string) (*bytes.Buffer,
if gocmdRunner == nil {
gocmdRunner = &gocommand.Runner{}
}
stdout, stderr, _, err := gocmdRunner.RunRaw(cfg.Context, inv)
stdout, stderr, friendlyErr, err := gocmdRunner.RunRaw(cfg.Context, inv)
if err != nil {
// Check for 'go' executable not being found.
if ee, ok := err.(*exec.Error); ok && ee.Err == exec.ErrNotFound {
@@ -886,7 +889,7 @@ func (state *golistState) invokeGo(verb string, args ...string) (*bytes.Buffer,
// Related to #24854
if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "unexpected directory layout") {
return nil, fmt.Errorf("%s", stderr.String())
return nil, friendlyErr
}
// Is there an error running the C compiler in cgo? This will be reported in the "Error" field
@@ -999,7 +1002,7 @@ func (state *golistState) invokeGo(verb string, args ...string) (*bytes.Buffer,
// TODO(matloob): Remove these once we can depend on go list to exit with a zero status with -e even when
// packages don't exist or a build fails.
if !usesExportData(cfg) && !containsGoFile(args) {
return nil, fmt.Errorf("go %v: %s: %s", args, exitErr, stderr)
return nil, friendlyErr
}
}
return stdout, nil

View File

@@ -339,6 +339,9 @@ type Package struct {
// forTest is the package under test, if any.
forTest string
// depsErrors is the DepsErrors field from the go list response, if any.
depsErrors []*packagesinternal.PackageError
// module is the module information for the package if it exists.
Module *Module
}
@@ -366,6 +369,9 @@ func init() {
packagesinternal.GetForTest = func(p interface{}) string {
return p.(*Package).forTest
}
packagesinternal.GetDepsErrors = func(p interface{}) []*packagesinternal.PackageError {
return p.(*Package).depsErrors
}
packagesinternal.GetGoCmdRunner = func(config interface{}) *gocommand.Runner {
return config.(*Config).gocmdRunner
}

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",

View File

@@ -10,6 +10,13 @@ import (
)
var GetForTest = func(p interface{}) string { return "" }
var GetDepsErrors = func(p interface{}) []*PackageError { return nil }
type PackageError struct {
ImportStack []string // shortest path from package named on command line to this one
Pos string // position of error (if present, file:line:col)
Err string // the error itself
}
var GetGoCmdRunner = func(config interface{}) *gocommand.Runner { return nil }

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
}

View File

@@ -1209,6 +1209,16 @@ const (
// }
InvalidTypeSwitch
// InvalidExprSwitch occurs when a switch expression is not comparable.
//
// Example:
// func _() {
// var a struct{ _ func() }
// switch a /* ERROR cannot switch on a */ {
// }
// }
InvalidExprSwitch
/* control flow > select */
// InvalidSelectCase occurs when a select case is not a channel send or

View File

@@ -124,24 +124,25 @@ func _() {
_ = x[DuplicateDefault-114]
_ = x[BadTypeKeyword-115]
_ = x[InvalidTypeSwitch-116]
_ = x[InvalidSelectCase-117]
_ = x[UndeclaredLabel-118]
_ = x[DuplicateLabel-119]
_ = x[MisplacedLabel-120]
_ = x[UnusedLabel-121]
_ = x[JumpOverDecl-122]
_ = x[JumpIntoBlock-123]
_ = x[InvalidMethodExpr-124]
_ = x[WrongArgCount-125]
_ = x[InvalidCall-126]
_ = x[UnusedResults-127]
_ = x[InvalidDefer-128]
_ = x[InvalidGo-129]
_ = x[InvalidExprSwitch-117]
_ = x[InvalidSelectCase-118]
_ = x[UndeclaredLabel-119]
_ = x[DuplicateLabel-120]
_ = x[MisplacedLabel-121]
_ = x[UnusedLabel-122]
_ = x[JumpOverDecl-123]
_ = x[JumpIntoBlock-124]
_ = x[InvalidMethodExpr-125]
_ = x[WrongArgCount-126]
_ = x[InvalidCall-127]
_ = x[UnusedResults-128]
_ = x[InvalidDefer-129]
_ = x[InvalidGo-130]
}
const _ErrorCode_name = "TestBlankPkgNameMismatchedPkgNameInvalidPkgUseBadImportPathBrokenImportImportCRenamedUnusedImportInvalidInitCycleDuplicateDeclInvalidDeclCycleInvalidTypeCycleInvalidConstInitInvalidConstValInvalidConstTypeUntypedNilWrongAssignCountUnassignableOperandNoNewVarMultiValAssignOpInvalidIfaceAssignInvalidChanAssignIncompatibleAssignUnaddressableFieldAssignNotATypeInvalidArrayLenBlankIfaceMethodIncomparableMapKeyInvalidIfaceEmbedInvalidPtrEmbedBadRecvInvalidRecvDuplicateFieldAndMethodDuplicateMethodInvalidBlankInvalidIotaMissingInitBodyInvalidInitSigInvalidInitDeclInvalidMainDeclTooManyValuesNotAnExprTruncatedFloatNumericOverflowUndefinedOpMismatchedTypesDivByZeroNonNumericIncDecUnaddressableOperandInvalidIndirectionNonIndexableOperandInvalidIndexSwappedSliceIndicesNonSliceableOperandInvalidSliceExprInvalidShiftCountInvalidShiftOperandInvalidReceiveInvalidSendDuplicateLitKeyMissingLitKeyInvalidLitIndexOversizeArrayLitMixedStructLitInvalidStructLitMissingLitFieldDuplicateLitFieldUnexportedLitFieldInvalidLitFieldUntypedLitInvalidLitAmbiguousSelectorUndeclaredImportedNameUnexportedNameUndeclaredNameMissingFieldOrMethodBadDotDotDotSyntaxNonVariadicDotDotDotMisplacedDotDotDotInvalidDotDotDotOperandInvalidDotDotDotUncalledBuiltinInvalidAppendInvalidCapInvalidCloseInvalidCopyInvalidComplexInvalidDeleteInvalidImagInvalidLenSwappedMakeArgsInvalidMakeInvalidRealInvalidAssertImpossibleAssertInvalidConversionInvalidUntypedConversionBadOffsetofSyntaxInvalidOffsetofUnusedExprUnusedVarMissingReturnWrongResultCountOutOfScopeResultInvalidCondInvalidPostDeclInvalidChanRangeInvalidIterVarInvalidRangeExprMisplacedBreakMisplacedContinueMisplacedFallthroughDuplicateCaseDuplicateDefaultBadTypeKeywordInvalidTypeSwitchInvalidSelectCaseUndeclaredLabelDuplicateLabelMisplacedLabelUnusedLabelJumpOverDeclJumpIntoBlockInvalidMethodExprWrongArgCountInvalidCallUnusedResultsInvalidDeferInvalidGo"
const _ErrorCode_name = "TestBlankPkgNameMismatchedPkgNameInvalidPkgUseBadImportPathBrokenImportImportCRenamedUnusedImportInvalidInitCycleDuplicateDeclInvalidDeclCycleInvalidTypeCycleInvalidConstInitInvalidConstValInvalidConstTypeUntypedNilWrongAssignCountUnassignableOperandNoNewVarMultiValAssignOpInvalidIfaceAssignInvalidChanAssignIncompatibleAssignUnaddressableFieldAssignNotATypeInvalidArrayLenBlankIfaceMethodIncomparableMapKeyInvalidIfaceEmbedInvalidPtrEmbedBadRecvInvalidRecvDuplicateFieldAndMethodDuplicateMethodInvalidBlankInvalidIotaMissingInitBodyInvalidInitSigInvalidInitDeclInvalidMainDeclTooManyValuesNotAnExprTruncatedFloatNumericOverflowUndefinedOpMismatchedTypesDivByZeroNonNumericIncDecUnaddressableOperandInvalidIndirectionNonIndexableOperandInvalidIndexSwappedSliceIndicesNonSliceableOperandInvalidSliceExprInvalidShiftCountInvalidShiftOperandInvalidReceiveInvalidSendDuplicateLitKeyMissingLitKeyInvalidLitIndexOversizeArrayLitMixedStructLitInvalidStructLitMissingLitFieldDuplicateLitFieldUnexportedLitFieldInvalidLitFieldUntypedLitInvalidLitAmbiguousSelectorUndeclaredImportedNameUnexportedNameUndeclaredNameMissingFieldOrMethodBadDotDotDotSyntaxNonVariadicDotDotDotMisplacedDotDotDotInvalidDotDotDotOperandInvalidDotDotDotUncalledBuiltinInvalidAppendInvalidCapInvalidCloseInvalidCopyInvalidComplexInvalidDeleteInvalidImagInvalidLenSwappedMakeArgsInvalidMakeInvalidRealInvalidAssertImpossibleAssertInvalidConversionInvalidUntypedConversionBadOffsetofSyntaxInvalidOffsetofUnusedExprUnusedVarMissingReturnWrongResultCountOutOfScopeResultInvalidCondInvalidPostDeclInvalidChanRangeInvalidIterVarInvalidRangeExprMisplacedBreakMisplacedContinueMisplacedFallthroughDuplicateCaseDuplicateDefaultBadTypeKeywordInvalidTypeSwitchInvalidExprSwitchInvalidSelectCaseUndeclaredLabelDuplicateLabelMisplacedLabelUnusedLabelJumpOverDeclJumpIntoBlockInvalidMethodExprWrongArgCountInvalidCallUnusedResultsInvalidDeferInvalidGo"
var _ErrorCode_index = [...]uint16{0, 4, 16, 33, 46, 59, 71, 85, 97, 113, 126, 142, 158, 174, 189, 205, 215, 231, 250, 258, 274, 292, 309, 327, 351, 359, 374, 390, 408, 425, 440, 447, 458, 481, 496, 508, 519, 534, 548, 563, 578, 591, 600, 614, 629, 640, 655, 664, 680, 700, 718, 737, 749, 768, 787, 803, 820, 839, 853, 864, 879, 892, 907, 923, 937, 953, 968, 985, 1003, 1018, 1028, 1038, 1055, 1077, 1091, 1105, 1125, 1143, 1163, 1181, 1204, 1220, 1235, 1248, 1258, 1270, 1281, 1295, 1308, 1319, 1329, 1344, 1355, 1366, 1379, 1395, 1412, 1436, 1453, 1468, 1478, 1487, 1500, 1516, 1532, 1543, 1558, 1574, 1588, 1604, 1618, 1635, 1655, 1668, 1684, 1698, 1715, 1732, 1747, 1761, 1775, 1786, 1798, 1811, 1828, 1841, 1852, 1865, 1877, 1886}
var _ErrorCode_index = [...]uint16{0, 4, 16, 33, 46, 59, 71, 85, 97, 113, 126, 142, 158, 174, 189, 205, 215, 231, 250, 258, 274, 292, 309, 327, 351, 359, 374, 390, 408, 425, 440, 447, 458, 481, 496, 508, 519, 534, 548, 563, 578, 591, 600, 614, 629, 640, 655, 664, 680, 700, 718, 737, 749, 768, 787, 803, 820, 839, 853, 864, 879, 892, 907, 923, 937, 953, 968, 985, 1003, 1018, 1028, 1038, 1055, 1077, 1091, 1105, 1125, 1143, 1163, 1181, 1204, 1220, 1235, 1248, 1258, 1270, 1281, 1295, 1308, 1319, 1329, 1344, 1355, 1366, 1379, 1395, 1412, 1436, 1453, 1468, 1478, 1487, 1500, 1516, 1532, 1543, 1558, 1574, 1588, 1604, 1618, 1635, 1655, 1668, 1684, 1698, 1715, 1732, 1749, 1764, 1778, 1792, 1803, 1815, 1828, 1845, 1858, 1869, 1882, 1894, 1903}
func (i ErrorCode) String() string {
i -= 1