aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/get/get.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2018-06-01 15:47:29 -0400
committerRuss Cox <rsc@golang.org>2018-06-04 14:18:39 +0000
commit446d76e62df3bcd84443a4d7319c963a214f7670 (patch)
tree4cade11caa36295cc7d1dbd2e02d7b1e08910a70 /src/cmd/go/internal/get/get.go
parent41dd2ebcee5652571f8cfa924597e67f3ddb6111 (diff)
downloadgo-446d76e62df3bcd84443a4d7319c963a214f7670.tar.gz
go-446d76e62df3bcd84443a4d7319c963a214f7670.zip
cmd/go: fix 'go get' compatibility for direct download of vgo-aware module
CL 109340 added “minimal module-awareness for legacy operation.” One part of that is reinterpreting imports inside code trees with go.mod files as using semantic import versioning, and converting them back to legacy import paths by stripping the major version element (for example, interpreting import "x.com/foo/v2/bar" as import "x.com/foo/bar"). This rewrite was not being applied during "go get", with the effect that once you had the target code downloaded already, everything was fine, but it didn't download and build successfully the first time. Fixes #25687. Change-Id: I3e122efdc8fd9a0a4e66f5aa3e6a99f90c7df779 Reviewed-on: https://go-review.googlesource.com/115797 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/get/get.go')
-rw-r--r--src/cmd/go/internal/get/get.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/go/internal/get/get.go b/src/cmd/go/internal/get/get.go
index 610c5407e9..5bfeac387c 100644
--- a/src/cmd/go/internal/get/get.go
+++ b/src/cmd/go/internal/get/get.go
@@ -217,7 +217,7 @@ func download(arg string, parent *load.Package, stk *load.ImportStack, mode int)
if parent == nil {
return load.LoadPackage(path, stk)
}
- return load.LoadImport(path, parent.Dir, parent, stk, nil, mode)
+ return load.LoadImport(path, parent.Dir, parent, stk, nil, mode|load.ResolveModule)
}
p := load1(arg, mode)
@@ -346,12 +346,12 @@ func download(arg string, parent *load.Package, stk *load.ImportStack, mode int)
base.Errorf("%s", err)
continue
}
- // If this is a test import, apply vendor lookup now.
- // We cannot pass useVendor to download, because
+ // If this is a test import, apply module and vendor lookup now.
+ // We cannot pass ResolveImport to download, because
// download does caching based on the value of path,
// so it must be the fully qualified path already.
if i >= len(p.Imports) {
- path = load.VendoredImportPath(p, path)
+ path = load.ResolveImportPath(p, path)
}
download(path, p, stk, 0)
}