From bf6843410318fce378b46c7de913ba7c57cf646c Mon Sep 17 00:00:00 2001 From: Trevor Pounds Date: Sat, 14 Sep 2019 07:06:10 -0400 Subject: [PATCH] Fix replaced dependencies (#691) * Update to ultraware/funlen v0.0.2. Fixes https://github.com/ultraware/funlen/pull/1. * Update to latest golang.org/x/tools. Fixes #687. Fixes https://github.com/golang/tools/pull/139. --- go.mod | 11 +- go.sum | 21 +++- vendor/golang.org/x/tools/go/analysis/doc.go | 16 +-- .../tools/go/analysis/passes/assign/assign.go | 8 +- .../tools/go/analysis/passes/printf/types.go | 2 +- .../x/tools/go/buildutil/overlay.go | 2 +- .../golang.org/x/tools/go/packages/golist.go | 28 ++++- .../x/tools/go/packages/packages.go | 33 +++-- .../golang.org/x/tools/go/ssa/ssautil/load.go | 2 +- .../x/tools/internal/imports/mod.go | 22 ++-- .../x/tools/internal/imports/zstdlib.go | 116 +++++++++++++----- vendor/modules.txt | 4 +- 12 files changed, 183 insertions(+), 82 deletions(-) diff --git a/go.mod b/go.mod index a30d7c5f9696..477e2693aae3 100644 --- a/go.mod +++ b/go.mod @@ -41,19 +41,12 @@ require ( github.com/spf13/viper v1.4.0 github.com/stretchr/testify v1.4.0 github.com/timakin/bodyclose v0.0.0-20190721030226-87058b9bfcec - github.com/ultraware/funlen v0.0.1 + github.com/ultraware/funlen v0.0.2 github.com/ultraware/whitespace v0.0.2 github.com/valyala/quicktemplate v1.1.1 - golang.org/x/tools v0.0.0-20190911022129-16c5e0f7d110 + golang.org/x/tools v0.0.0-20190912215617-3720d1ec3678 gopkg.in/yaml.v2 v2.2.2 mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect mvdan.cc/unparam v0.0.0-20190209190245-fbb59629db34 ) - -replace ( - // https://github.com/ultraware/funlen/pull/1 - github.com/ultraware/funlen => github.com/golangci/funlen v0.0.0-20190909161642-5e59b9546114 - // https://github.com/golang/tools/pull/139 - golang.org/x/tools => github.com/golangci/tools v0.0.0-20190910062050-3540c026601b -) diff --git a/go.sum b/go.sum index a44b1cacbc45..4ad2756da2b1 100644 --- a/go.sum +++ b/go.sum @@ -82,8 +82,6 @@ github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9 github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6 h1:YYWNAGTKWhKpcLLt7aSj/odlKrSrelQwlovBpDuf19w= github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6/go.mod h1:DbHgvLiFKX1Sh2T1w8Q/h4NAI8MHIpzCdnBUDTXU3I0= -github.com/golangci/funlen v0.0.0-20190909161642-5e59b9546114 h1:eubR6yxVUUlbUuBBn1ONXalxuCjCrDfKvRc0eF6Xnio= -github.com/golangci/funlen v0.0.0-20190909161642-5e59b9546114/go.mod h1:kJMYlbyWK6uaK+J3BjNrQMk0t3CgLgsXgQnOlS4iGeg= github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613 h1:9kfjN3AdxcbsZBf8NjltjWihK2QfBBBZuv91cMFfDHw= github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613/go.mod h1:SyvUF2NxV+sN8upjjeVYr5W7tyxaT1JVtvhKhOn2ii8= github.com/golangci/go-tools v0.0.0-20190318055746-e32c54105b7c h1:/7detzz5stiXWPzkTlPTzkBEIIE4WGpppBJYjKqBiPI= @@ -108,8 +106,6 @@ github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21 h1:leSNB7iYzLYSS github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21/go.mod h1:tf5+bzsHdTM0bsB7+8mt0GUMvjCgwLpTapNZHU8AajI= github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0 h1:HVfrLniijszjS1aiNg8JbBMO2+E1WIQ+j/gL4SQqGPg= github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0/go.mod h1:qOQCunEYvmd/TLamH+7LlVccLvUH5kZNhbCgTHoBbp4= -github.com/golangci/tools v0.0.0-20190910062050-3540c026601b h1:0gJ6G80gfLCh1Lz2O2m3tqESG5QJYYZKS0Z3wa2YzPM= -github.com/golangci/tools v0.0.0-20190910062050-3540c026601b/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSWhqsYNgcuWO2kFlpdOZbP0+yRjmvPGys= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -233,6 +229,8 @@ github.com/timakin/bodyclose v0.0.0-20190721030226-87058b9bfcec/go.mod h1:Qimiff github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/ultraware/funlen v0.0.2 h1:Av96YVBwwNSe4MLR7iI/BIa3VyI7/djnto/pK3Uxbdo= +github.com/ultraware/funlen v0.0.2/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= github.com/ultraware/whitespace v0.0.2 h1:iL4Un0C3VaMIBGfDogtcdBeSotjfSHYW8OdI1U9Vqas= github.com/ultraware/whitespace v0.0.2/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= @@ -285,6 +283,21 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181117154741-2ddaf7f79a09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190110163146-51295c7ec13a/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190121143147-24cd39ecf745/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190322203728-c1a832b0ad89/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190521203540-521d6ed310dd/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911022129-16c5e0f7d110/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190912215617-3720d1ec3678 h1:rM1Udd0CgtYI3KUIhu9ROz0QCqjW+n/ODp/hH7c60Xc= +golang.org/x/tools v0.0.0-20190912215617-3720d1ec3678/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= diff --git a/vendor/golang.org/x/tools/go/analysis/doc.go b/vendor/golang.org/x/tools/go/analysis/doc.go index 2d44b0458a9a..a2353fc88b9c 100644 --- a/vendor/golang.org/x/tools/go/analysis/doc.go +++ b/vendor/golang.org/x/tools/go/analysis/doc.go @@ -67,7 +67,7 @@ To add a new Analyzer to an existing driver, add another item to the list: } A driver may use the name, flags, and documentation to provide on-line -help that describes the analyses its performs. +help that describes the analyses it performs. The doc comment contains a brief one-line summary, optionally followed by paragraphs of explanation. The vet command, shown below, is an example of a driver that runs @@ -169,7 +169,7 @@ type information, and source positions for a single package of Go code. The OtherFiles field provides the names, but not the contents, of non-Go files such as assembly that are part of this package. See the "asmdecl" -or "buildtags" analyzers for examples of loading non-Go files and report +or "buildtags" analyzers for examples of loading non-Go files and reporting diagnostics against them. The ResultOf field provides the results computed by the analyzers @@ -231,7 +231,7 @@ understood as alternative or non-standard type systems. For example, vet's printf checker infers whether a function has the "printf wrapper" type, and it applies stricter checks to calls of such functions. In addition, it records which functions are printf wrappers for use by -later analysis units to identify other printf wrappers by induction. +later analysis passes to identify other printf wrappers by induction. A result such as “f is a printf wrapper” that is not interesting by itself but serves as a stepping stone to an interesting result (such as a diagnostic) is called a "fact". @@ -252,9 +252,9 @@ An Analyzer that uses facts must declare their types: type isWrapper struct{} // => *types.Func f “is a printf wrapper” -A driver program ensures that facts for a pass’s dependencies are -generated before analyzing the pass and are responsible for propagating -facts between from one pass to another, possibly across address spaces. +The driver program ensures that facts for a pass’s dependencies are +generated before analyzing the package and is responsible for propagating +facts from one package to another, possibly across address spaces. Consequently, Facts must be serializable. The API requires that drivers use the gob encoding, an efficient, robust, self-describing binary protocol. A fact type may implement the GobEncoder/GobDecoder interfaces @@ -288,10 +288,10 @@ not currently apply analyzers to packages of the standard library. Therefore, for best results, analyzer authors should not rely on analysis facts being available for standard packages. For example, although the printf checker is capable of deducing during -analysis of the log package that log.Printf is a printf-wrapper, +analysis of the log package that log.Printf is a printf wrapper, this fact is built in to the analyzer so that it correctly checks calls to log.Printf even when run in a driver that does not apply -it to standard packages. We plan to remove this limitation in future. +it to standard packages. We would like to remove this limitation in future. Testing an Analyzer diff --git a/vendor/golang.org/x/tools/go/analysis/passes/assign/assign.go b/vendor/golang.org/x/tools/go/analysis/passes/assign/assign.go index 4dff2908c32b..a9aefe52fe3a 100644 --- a/vendor/golang.org/x/tools/go/analysis/passes/assign/assign.go +++ b/vendor/golang.org/x/tools/go/analysis/passes/assign/assign.go @@ -9,6 +9,7 @@ package assign // methods that are on T instead of *T. import ( + "fmt" "go/ast" "go/token" "reflect" @@ -59,7 +60,12 @@ func run(pass *analysis.Pass) (interface{}, error) { le := analysisutil.Format(pass.Fset, lhs) re := analysisutil.Format(pass.Fset, rhs) if le == re { - pass.Reportf(stmt.Pos(), "self-assignment of %s to %s", re, le) + pass.Report(analysis.Diagnostic{ + Pos: stmt.Pos(), Message: fmt.Sprintf("self-assignment of %s to %s", re, le), + SuggestedFixes: []analysis.SuggestedFix{ + {Message: "Remove", TextEdits: []analysis.TextEdit{{stmt.Pos(), stmt.End(), []byte{}}}}, + }, + }) } } }) diff --git a/vendor/golang.org/x/tools/go/analysis/passes/printf/types.go b/vendor/golang.org/x/tools/go/analysis/passes/printf/types.go index 5000d9acc9e3..bd8a594ef57b 100644 --- a/vendor/golang.org/x/tools/go/analysis/passes/printf/types.go +++ b/vendor/golang.org/x/tools/go/analysis/passes/printf/types.go @@ -234,7 +234,7 @@ func matchStructArgType(pass *analysis.Pass, t printfArgType, typ *types.Struct, return false } if t&argString != 0 && !typf.Exported() && isConvertibleToString(pass, typf.Type()) { - // Issue #17798: unexported Stringer or error cannot be properly fomatted. + // Issue #17798: unexported Stringer or error cannot be properly formatted. return false } } diff --git a/vendor/golang.org/x/tools/go/buildutil/overlay.go b/vendor/golang.org/x/tools/go/buildutil/overlay.go index 3f71c4fef75e..8e239086bd44 100644 --- a/vendor/golang.org/x/tools/go/buildutil/overlay.go +++ b/vendor/golang.org/x/tools/go/buildutil/overlay.go @@ -65,7 +65,7 @@ func OverlayContext(orig *build.Context, overlay map[string][]byte) *build.Conte // // The archive consists of a series of files. Each file consists of a // name, a decimal file size and the file contents, separated by -// newlinews. No newline follows after the file contents. +// newlines. No newline follows after the file contents. func ParseOverlayArchive(archive io.Reader) (map[string][]byte, error) { overlay := make(map[string][]byte) r := bufio.NewReader(archive) diff --git a/vendor/golang.org/x/tools/go/packages/golist.go b/vendor/golang.org/x/tools/go/packages/golist.go index c76293eaa8fa..6b341b7e85eb 100644 --- a/vendor/golang.org/x/tools/go/packages/golist.go +++ b/vendor/golang.org/x/tools/go/packages/golist.go @@ -21,6 +21,7 @@ import ( "strings" "sync" "time" + "unicode" "golang.org/x/tools/go/internal/packagesdriver" "golang.org/x/tools/internal/gopathwalk" @@ -677,7 +678,7 @@ func golistDriver(cfg *Config, rootsDirs func() *goInfo, words ...string) (*driv // go list -e, when given an absolute path, will find the package contained at // that directory. But when no package exists there, it will return a fake package // with an error and the ImportPath set to the absolute path provided to go list. - // Try toto convert that absolute path to what its package path would be if it's + // Try to convert that absolute path to what its package path would be if it's // contained in a known module or GOPATH entry. This will allow the package to be // properly "reclaimed" when overlays are processed. if filepath.IsAbs(p.ImportPath) && p.Error != nil { @@ -888,8 +889,19 @@ func invokeGo(cfg *Config, args ...string) (*bytes.Buffer, error) { // and should be suppressed by go list -e. // // This condition is not perfect yet because the error message can include other error messages than runtime/cgo. - if len(stderr.String()) > 0 && strings.HasPrefix(stderr.String(), "# runtime/cgo\n") { - return stdout, nil + isPkgPathRune := func(r rune) bool { + // From https://golang.org/ref/spec#Import_declarations: + // Implementation restriction: A compiler may restrict ImportPaths to non-empty strings + // using only characters belonging to Unicode's L, M, N, P, and S general categories + // (the Graphic characters without spaces) and may also exclude the + // characters !"#$%&'()*,:;<=>?[\]^`{|} and the Unicode replacement character U+FFFD. + return unicode.IsOneOf([]*unicode.RangeTable{unicode.L, unicode.M, unicode.N, unicode.P, unicode.S}, r) && + strings.IndexRune("!\"#$%&'()*,:;<=>?[\\]^`{|}\uFFFD", r) == -1 + } + if len(stderr.String()) > 0 && strings.HasPrefix(stderr.String(), "# ") { + if strings.HasPrefix(strings.TrimLeftFunc(stderr.String()[len("# "):], isPkgPathRune), "\n") { + return stdout, nil + } } // This error only appears in stderr. See golang.org/cl/166398 for a fix in go list to show @@ -928,6 +940,16 @@ func invokeGo(cfg *Config, args ...string) (*bytes.Buffer, error) { return bytes.NewBufferString(output), nil } + // Workaround for #34273. go list -e with GO111MODULE=on has incorrect behavior when listing a + // directory outside any module. + if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "outside available modules") { + output := fmt.Sprintf(`{"ImportPath": %q,"Incomplete": true,"Error": {"Pos": "","Err": %q}}`, + // TODO(matloob): command-line-arguments isn't correct here. + "command-line-arguments", strings.Trim(stderr.String(), "\n")) + return bytes.NewBufferString(output), nil + + } + // Workaround for an instance of golang.org/issue/26755: go list -e will return a non-zero exit // status if there's a dependency on a package that doesn't exist. But it should return // a zero exit status and set an error on that package. diff --git a/vendor/golang.org/x/tools/go/packages/packages.go b/vendor/golang.org/x/tools/go/packages/packages.go index 137814066de4..50b93c859bfc 100644 --- a/vendor/golang.org/x/tools/go/packages/packages.go +++ b/vendor/golang.org/x/tools/go/packages/packages.go @@ -415,7 +415,7 @@ type loader struct { parseCacheMu sync.Mutex exportMu sync.Mutex // enforces mutual exclusion of exportdata operations - // Config.Mode contains the implied mode (see implyLoadMode). + // Config.Mode contains the implied mode (see impliedLoadMode). // Implied mode contains all the fields we need the data for. // In requestedMode there are the actually requested fields. // We'll zero them out before returning packages to the user. @@ -463,6 +463,10 @@ func newLoader(cfg *Config) *loader { } } + // Save the actually requested fields. We'll zero them out before returning packages to the user. + ld.requestedMode = ld.Mode + ld.Mode = impliedLoadMode(ld.Mode) + if ld.Mode&NeedTypes != 0 { if ld.Fset == nil { ld.Fset = token.NewFileSet() @@ -478,9 +482,6 @@ func newLoader(cfg *Config) *loader { } } - // Save the actually requested fields. We'll zero them out before returning packages to the user. - ld.requestedMode = ld.Mode - ld.implyLoadMode() return ld } @@ -769,6 +770,14 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) { lpkg.Errors = append(lpkg.Errors, errs...) } + if len(lpkg.CompiledGoFiles) == 0 && lpkg.ExportFile != "" { + // The config requested loading sources and types, but sources are missing. + // Add an error to the package and fall back to loading from export data. + appendError(Error{"-", fmt.Sprintf("sources missing for package %s", lpkg.ID), ParseError}) + ld.loadFromExportData(lpkg) + return // can't get syntax trees for this package + } + files, errs := ld.parseFiles(lpkg.CompiledGoFiles) for _, err := range errs { appendError(err) @@ -1080,23 +1089,23 @@ func (ld *loader) loadFromExportData(lpkg *loaderPackage) (*types.Package, error return tpkg, nil } -// implyLoadMode adds dependencies for choosed LoadMode in ld.Mode -func (ld *loader) implyLoadMode() { - if ld.Mode&NeedTypesInfo != 0 && ld.Mode&NeedImports == 0 { +// impliedLoadMode returns loadMode with it's dependencies +func impliedLoadMode(loadMode LoadMode) LoadMode { + if loadMode&NeedTypesInfo != 0 && loadMode&NeedImports == 0 { // If NeedTypesInfo, go/packages needs to do typechecking itself so it can // associate type info with the AST. To do so, we need the export data // for dependencies, which means we need to ask for the direct dependencies. // NeedImports is used to ask for the direct dependencies. - ld.Mode |= NeedImports - ld.Logf("Added load mode dependency of NeedTypesInfo: NeedImports") + loadMode |= NeedImports } - if ld.Mode&NeedDeps != 0 && ld.Mode&NeedImports == 0 { + if loadMode&NeedDeps != 0 && loadMode&NeedImports == 0 { // With NeedDeps we need to load at least direct dependencies. // NeedImports is used to ask for the direct dependencies. - ld.Mode |= NeedImports - ld.Logf("Added load mode dependency of NeedDeps: NeedImports") + loadMode |= NeedImports } + + return loadMode } func usesExportData(cfg *Config) bool { diff --git a/vendor/golang.org/x/tools/go/ssa/ssautil/load.go b/vendor/golang.org/x/tools/go/ssa/ssautil/load.go index 659d19fdbba9..6d65b78ef289 100644 --- a/vendor/golang.org/x/tools/go/ssa/ssautil/load.go +++ b/vendor/golang.org/x/tools/go/ssa/ssautil/load.go @@ -46,7 +46,7 @@ func Packages(initial []*packages.Package, mode ssa.BuilderMode) (*ssa.Program, // // AllPackages creates an SSA package for each well-typed package in the // initial list, plus all their dependencies. The resulting list of -// packages corresponds to the list of intial packages, and may contain +// packages corresponds to the list of initial packages, and may contain // a nil if SSA code could not be constructed for the corresponding // initial package due to type errors. // diff --git a/vendor/golang.org/x/tools/internal/imports/mod.go b/vendor/golang.org/x/tools/internal/imports/mod.go index 271c7d28329c..551bae89859f 100644 --- a/vendor/golang.org/x/tools/internal/imports/mod.go +++ b/vendor/golang.org/x/tools/internal/imports/mod.go @@ -106,6 +106,8 @@ func (r *ModuleResolver) init() error { // findPackage returns the module and directory that contains the package at // the given import path, or returns nil, "" if no module is in scope. func (r *ModuleResolver) findPackage(importPath string) (*ModuleJSON, string) { + // This can't find packages in the stdlib, but that's harmless for all + // the existing code paths. for _, m := range r.ModsByModPath { if !strings.HasPrefix(importPath, m.Path) { continue @@ -418,24 +420,28 @@ func (r *ModuleResolver) scanDirForPackage(root gopathwalk.Root, dir string) (di importPath = subdir } + result := directoryPackageInfo{ + status: directoryScanned, + dir: dir, + nonCanonicalImportPath: importPath, + needsReplace: false, + } + if root.Type == gopathwalk.RootGOROOT { + // stdlib packages are always in scope, despite the confusing go.mod + return result, nil + } // Check that this package is not obviously impossible to import. modFile := r.findModFile(dir) - var needsReplace bool modBytes, err := ioutil.ReadFile(modFile) if err == nil && !strings.HasPrefix(importPath, modulePath(modBytes)) { // The module's declared path does not match // its expected path. It probably needs a // replace directive we don't have. - needsReplace = true + result.needsReplace = true } - return directoryPackageInfo{ - status: directoryScanned, - dir: dir, - nonCanonicalImportPath: importPath, - needsReplace: needsReplace, - }, nil + return result, nil } // modCacheRegexp splits a path in a module cache into module, module version, and package. diff --git a/vendor/golang.org/x/tools/internal/imports/zstdlib.go b/vendor/golang.org/x/tools/internal/imports/zstdlib.go index d81b8c5307fe..544339e53b2b 100644 --- a/vendor/golang.org/x/tools/internal/imports/zstdlib.go +++ b/vendor/golang.org/x/tools/internal/imports/zstdlib.go @@ -125,6 +125,7 @@ var stdlib = map[string]map[string]bool{ "ToTitleSpecial": true, "ToUpper": true, "ToUpperSpecial": true, + "ToValidUTF8": true, "Trim": true, "TrimFunc": true, "TrimLeft": true, @@ -304,6 +305,18 @@ var stdlib = map[string]map[string]bool{ "Sign": true, "Verify": true, }, + "crypto/ed25519": map[string]bool{ + "GenerateKey": true, + "NewKeyFromSeed": true, + "PrivateKey": true, + "PrivateKeySize": true, + "PublicKey": true, + "PublicKeySize": true, + "SeedSize": true, + "Sign": true, + "SignatureSize": true, + "Verify": true, + }, "crypto/elliptic": map[string]bool{ "Curve": true, "CurveParams": true, @@ -420,6 +433,7 @@ var stdlib = map[string]map[string]bool{ "ECDSAWithP384AndSHA384": true, "ECDSAWithP521AndSHA512": true, "ECDSAWithSHA1": true, + "Ed25519": true, "Listen": true, "LoadX509KeyPair": true, "NewLRUClientSessionCache": true, @@ -478,35 +492,36 @@ var stdlib = map[string]map[string]bool{ "X509KeyPair": true, }, "crypto/x509": map[string]bool{ - "CANotAuthorizedForExtKeyUsage": true, - "CANotAuthorizedForThisName": true, - "CertPool": true, - "Certificate": true, - "CertificateInvalidError": true, - "CertificateRequest": true, - "ConstraintViolationError": true, - "CreateCertificate": true, - "CreateCertificateRequest": true, - "DSA": true, - "DSAWithSHA1": true, - "DSAWithSHA256": true, - "DecryptPEMBlock": true, - "ECDSA": true, - "ECDSAWithSHA1": true, - "ECDSAWithSHA256": true, - "ECDSAWithSHA384": true, - "ECDSAWithSHA512": true, - "EncryptPEMBlock": true, - "ErrUnsupportedAlgorithm": true, - "Expired": true, - "ExtKeyUsage": true, - "ExtKeyUsageAny": true, - "ExtKeyUsageClientAuth": true, - "ExtKeyUsageCodeSigning": true, - "ExtKeyUsageEmailProtection": true, - "ExtKeyUsageIPSECEndSystem": true, - "ExtKeyUsageIPSECTunnel": true, - "ExtKeyUsageIPSECUser": true, + "CANotAuthorizedForExtKeyUsage": true, + "CANotAuthorizedForThisName": true, + "CertPool": true, + "Certificate": true, + "CertificateInvalidError": true, + "CertificateRequest": true, + "ConstraintViolationError": true, + "CreateCertificate": true, + "CreateCertificateRequest": true, + "DSA": true, + "DSAWithSHA1": true, + "DSAWithSHA256": true, + "DecryptPEMBlock": true, + "ECDSA": true, + "ECDSAWithSHA1": true, + "ECDSAWithSHA256": true, + "ECDSAWithSHA384": true, + "ECDSAWithSHA512": true, + "Ed25519": true, + "EncryptPEMBlock": true, + "ErrUnsupportedAlgorithm": true, + "Expired": true, + "ExtKeyUsage": true, + "ExtKeyUsageAny": true, + "ExtKeyUsageClientAuth": true, + "ExtKeyUsageCodeSigning": true, + "ExtKeyUsageEmailProtection": true, + "ExtKeyUsageIPSECEndSystem": true, + "ExtKeyUsageIPSECTunnel": true, + "ExtKeyUsageIPSECUser": true, "ExtKeyUsageMicrosoftCommercialCodeSigning": true, "ExtKeyUsageMicrosoftKernelCodeSigning": true, "ExtKeyUsageMicrosoftServerGatedCrypto": true, @@ -558,6 +573,7 @@ var stdlib = map[string]map[string]bool{ "ParsePKCS8PrivateKey": true, "ParsePKIXPublicKey": true, "PublicKeyAlgorithm": true, + "PureEd25519": true, "RSA": true, "SHA1WithRSA": true, "SHA256WithRSA": true, @@ -612,8 +628,10 @@ var stdlib = map[string]map[string]bool{ "NamedArg": true, "NullBool": true, "NullFloat64": true, + "NullInt32": true, "NullInt64": true, "NullString": true, + "NullTime": true, "Open": true, "OpenDB": true, "Out": true, @@ -860,6 +878,7 @@ var stdlib = map[string]map[string]bool{ "UcharType": true, "UintType": true, "UnspecifiedType": true, + "UnsupportedType": true, "VoidType": true, }, "debug/elf": map[string]bool{ @@ -2505,7 +2524,10 @@ var stdlib = map[string]map[string]bool{ "UnsupportedTypeError": true, }, "errors": map[string]bool{ - "New": true, + "As": true, + "Is": true, + "New": true, + "Unwrap": true, }, "expvar": map[string]bool{ "Do": true, @@ -2615,10 +2637,12 @@ var stdlib = map[string]map[string]bool{ "CommentMap": true, "CompositeLit": true, "Con": true, + "Decl": true, "DeclStmt": true, "DeferStmt": true, "Ellipsis": true, "EmptyStmt": true, + "Expr": true, "ExprStmt": true, "Field": true, "FieldFilter": true, @@ -2679,7 +2703,9 @@ var stdlib = map[string]map[string]bool{ "SendStmt": true, "SliceExpr": true, "SortImports": true, + "Spec": true, "StarExpr": true, + "Stmt": true, "StructType": true, "SwitchStmt": true, "Typ": true, @@ -2725,6 +2751,7 @@ var stdlib = map[string]map[string]bool{ "Int": true, "Int64Val": true, "Kind": true, + "Make": true, "MakeBool": true, "MakeFloat64": true, "MakeFromBytes": true, @@ -2746,6 +2773,8 @@ var stdlib = map[string]map[string]bool{ "Uint64Val": true, "UnaryOp": true, "Unknown": true, + "Val": true, + "Value": true, }, "go/doc": map[string]bool{ "AllDecls": true, @@ -2855,6 +2884,9 @@ var stdlib = map[string]map[string]bool{ "INC": true, "INT": true, "INTERFACE": true, + "IsExported": true, + "IsIdentifier": true, + "IsKeyword": true, "LAND": true, "LBRACE": true, "LBRACK": true, @@ -2916,6 +2948,7 @@ var stdlib = map[string]map[string]bool{ "Byte": true, "Chan": true, "ChanDir": true, + "CheckExpr": true, "Checker": true, "Comparable": true, "Complex128": true, @@ -2991,6 +3024,7 @@ var stdlib = map[string]map[string]bool{ "NewTypeName": true, "NewVar": true, "Nil": true, + "Object": true, "ObjectString": true, "Package": true, "PkgName": true, @@ -3349,6 +3383,7 @@ var stdlib = map[string]map[string]bool{ "SetFlags": true, "SetOutput": true, "SetPrefix": true, + "Writer": true, }, "log/syslog": map[string]bool{ "Dial": true, @@ -3801,6 +3836,7 @@ var stdlib = map[string]map[string]bool{ "MethodTrace": true, "NewFileTransport": true, "NewRequest": true, + "NewRequestWithContext": true, "NewServeMux": true, "NoBody": true, "NotFound": true, @@ -3825,6 +3861,7 @@ var stdlib = map[string]map[string]bool{ "SameSite": true, "SameSiteDefaultMode": true, "SameSiteLaxMode": true, + "SameSiteNoneMode": true, "SameSiteStrictMode": true, "Serve": true, "ServeContent": true, @@ -3846,6 +3883,7 @@ var stdlib = map[string]map[string]bool{ "StatusConflict": true, "StatusContinue": true, "StatusCreated": true, + "StatusEarlyHints": true, "StatusExpectationFailed": true, "StatusFailedDependency": true, "StatusForbidden": true, @@ -4163,6 +4201,7 @@ var stdlib = map[string]map[string]bool{ "Truncate": true, "Unsetenv": true, "UserCacheDir": true, + "UserConfigDir": true, "UserHomeDir": true, }, "os/exec": map[string]bool{ @@ -4293,6 +4332,7 @@ var stdlib = map[string]map[string]bool{ "StructOf": true, "StructTag": true, "Swapper": true, + "Type": true, "TypeOf": true, "Uint": true, "Uint16": true, @@ -4588,6 +4628,7 @@ var stdlib = map[string]map[string]bool{ "ToTitleSpecial": true, "ToUpper": true, "ToUpperSpecial": true, + "ToValidUTF8": true, "Trim": true, "TrimFunc": true, "TrimLeft": true, @@ -7989,6 +8030,7 @@ var stdlib = map[string]map[string]bool{ "Rmdir": true, "RouteMessage": true, "RouteRIB": true, + "RoutingMessage": true, "RtAttr": true, "RtGenmsg": true, "RtMetrics": true, @@ -9357,6 +9399,7 @@ var stdlib = map[string]map[string]bool{ "SlicePtrFromStrings": true, "SockFilter": true, "SockFprog": true, + "Sockaddr": true, "SockaddrDatalink": true, "SockaddrGen": true, "SockaddrInet4": true, @@ -9784,6 +9827,8 @@ var stdlib = map[string]map[string]bool{ "XP1_UNI_SEND": true, }, "syscall/js": map[string]bool{ + "CopyBytesToGo": true, + "CopyBytesToJS": true, "Error": true, "Func": true, "FuncOf": true, @@ -9798,8 +9843,6 @@ var stdlib = map[string]map[string]bool{ "TypeString": true, "TypeSymbol": true, "TypeUndefined": true, - "TypedArray": true, - "TypedArrayOf": true, "Undefined": true, "Value": true, "ValueError": true, @@ -9815,6 +9858,7 @@ var stdlib = map[string]map[string]bool{ "CoverBlock": true, "CoverMode": true, "Coverage": true, + "Init": true, "InternalBenchmark": true, "InternalExample": true, "InternalTest": true, @@ -9828,6 +9872,7 @@ var stdlib = map[string]map[string]bool{ "RunTests": true, "Short": true, "T": true, + "TB": true, "Verbose": true, }, "testing/iotest": map[string]bool{ @@ -10063,6 +10108,7 @@ var stdlib = map[string]map[string]bool{ "Devanagari": true, "Diacritic": true, "Digit": true, + "Dogra": true, "Duployan": true, "Egyptian_Hieroglyphs": true, "Elbasan": true, @@ -10077,9 +10123,11 @@ var stdlib = map[string]map[string]bool{ "GraphicRanges": true, "Greek": true, "Gujarati": true, + "Gunjala_Gondi": true, "Gurmukhi": true, "Han": true, "Hangul": true, + "Hanifi_Rohingya": true, "Hanunoo": true, "Hatran": true, "Hebrew": true, @@ -10140,6 +10188,7 @@ var stdlib = map[string]map[string]bool{ "Lydian": true, "M": true, "Mahajani": true, + "Makasar": true, "Malayalam": true, "Mandaic": true, "Manichaean": true, @@ -10152,6 +10201,7 @@ var stdlib = map[string]map[string]bool{ "MaxRune": true, "Mc": true, "Me": true, + "Medefaidrin": true, "Meetei_Mayek": true, "Mende_Kikakui": true, "Meroitic_Cursive": true, @@ -10181,6 +10231,7 @@ var stdlib = map[string]map[string]bool{ "Old_North_Arabian": true, "Old_Permic": true, "Old_Persian": true, + "Old_Sogdian": true, "Old_South_Arabian": true, "Old_Turkic": true, "Oriya": true, @@ -10241,6 +10292,7 @@ var stdlib = map[string]map[string]bool{ "Sm": true, "So": true, "Soft_Dotted": true, + "Sogdian": true, "Sora_Sompeng": true, "Soyombo": true, "Space": true, diff --git a/vendor/modules.txt b/vendor/modules.txt index 86c2640ae931..5d3b90ce3f03 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -187,7 +187,7 @@ github.com/stretchr/testify/assert github.com/stretchr/testify/require # github.com/timakin/bodyclose v0.0.0-20190721030226-87058b9bfcec github.com/timakin/bodyclose/passes/bodyclose -# github.com/ultraware/funlen v0.0.1 => github.com/golangci/funlen v0.0.0-20190909161642-5e59b9546114 +# github.com/ultraware/funlen v0.0.2 github.com/ultraware/funlen # github.com/ultraware/whitespace v0.0.2 github.com/ultraware/whitespace @@ -202,7 +202,7 @@ golang.org/x/sys/windows golang.org/x/text/transform golang.org/x/text/unicode/norm golang.org/x/text/width -# golang.org/x/tools v0.0.0-20190911022129-16c5e0f7d110 => github.com/golangci/tools v0.0.0-20190910062050-3540c026601b +# golang.org/x/tools v0.0.0-20190912215617-3720d1ec3678 golang.org/x/tools/go/analysis golang.org/x/tools/go/analysis/passes/asmdecl golang.org/x/tools/go/analysis/passes/assign