cmd/go: disable vendoredImportPath for code outside $GOPATH
It was crashing.
This fixes the build for
GO15VENDOREXPERIMENT=1 go test -short runtime
Fixes #11416.
Change-Id: I74a9114cdd8ebafcc9d2a6f40bf500db19c6e825
Reviewed-on: https://go-review.googlesource.com/11964
Reviewed-by: Russ Cox <rsc@golang.org>
diff --git a/src/cmd/go/pkg.go b/src/cmd/go/pkg.go
index 51567b5..f949d4e 100644
--- a/src/cmd/go/pkg.go
+++ b/src/cmd/go/pkg.go
@@ -355,7 +355,7 @@
// it searched along the way, to help prepare a useful error message should path turn
// out not to exist.
func vendoredImportPath(parent *Package, path string) (found string, searched []string) {
- if parent == nil || !go15VendorExperiment {
+ if parent == nil || parent.Root == "" || !go15VendorExperiment {
return path, nil
}
dir := filepath.Clean(parent.Dir)