aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modload/query.go
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2019-10-08 14:23:43 -0400
committerBryan C. Mills <bcmills@google.com>2019-10-09 14:16:09 +0000
commit421d35cf69f4a18edf96004ba99c01e629a0f79f (patch)
tree5563ed2246fb7e920f3e2286f347cb10aea5a9c9 /src/cmd/go/internal/modload/query.go
parent0b204f958e0960fab34e09812eb5a3396ed3f1c9 (diff)
downloadgo-421d35cf69f4a18edf96004ba99c01e629a0f79f.tar.gz
go-421d35cf69f4a18edf96004ba99c01e629a0f79f.zip
cmd/go: suppress more errors in package-to-module loading
In CL 197059, I suppressed errors if the target package was already found. However, that does not cover the case of passing a '/v2' module path to 'go get' when the module does not contain a package at its root. This CL is a minimal fix for that case, intended to be backportable to 1.13. (Longer term, I intend to rework the version-validation check to treat all mismatched paths as ErrNotExist.) Fixes #34746 Updates #34383 Change-Id: Ia963c2ea00fae424812b8f46a4d6c2c668252147 Reviewed-on: https://go-review.googlesource.com/c/go/+/199839 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/cmd/go/internal/modload/query.go')
-rw-r--r--src/cmd/go/internal/modload/query.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/go/internal/modload/query.go b/src/cmd/go/internal/modload/query.go
index 0359470d95..75c18f25cc 100644
--- a/src/cmd/go/internal/modload/query.go
+++ b/src/cmd/go/internal/modload/query.go
@@ -472,10 +472,10 @@ func queryPrefixModules(candidateModules []string, queryModule func(path string)
notExistErr = rErr
}
} else if err == nil {
- if len(found) > 0 {
- // golang.org/issue/34094: If we have already found a module
- // containing the target package, ignore errors for modules with
- // shorter paths.
+ if len(found) > 0 || noPackage != nil {
+ // golang.org/issue/34094: If we have already found a module that
+ // could potentially contain the target package, ignore unclassified
+ // errors for modules with shorter paths.
// golang.org/issue/34383 is a special case of this: if we have
// already found example.com/foo/v2@v2.0.0 with a matching go.mod