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

@@ -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
}