Commit 10d096fe authored by Russ Cox's avatar Russ Cox

cmd/go: fix import config debugging flag

Was improperly bypassed in a couple places.

Change-Id: I13426b3efe68b9e67324c283540d0ef7b81b3d41
Reviewed-on: https://go-review.googlesource.com/91636
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent f598ad58
...@@ -416,6 +416,9 @@ func LoadImport(path, srcDir string, parent *Package, stk *ImportStack, importPo ...@@ -416,6 +416,9 @@ func LoadImport(path, srcDir string, parent *Package, stk *ImportStack, importPo
var err error var err error
if debugDeprecatedImportcfgDir != "" { if debugDeprecatedImportcfgDir != "" {
bp, err = cfg.BuildContext.ImportDir(debugDeprecatedImportcfgDir, 0) bp, err = cfg.BuildContext.ImportDir(debugDeprecatedImportcfgDir, 0)
} else if DebugDeprecatedImportcfg.enabled {
bp = new(build.Package)
err = fmt.Errorf("unknown import path %q: not in import cfg", importPath)
} else { } else {
buildMode := build.ImportComment buildMode := build.ImportComment
if mode&UseVendor == 0 || path != origPath { if mode&UseVendor == 0 || path != origPath {
...@@ -514,6 +517,13 @@ func isDir(path string) bool { ...@@ -514,6 +517,13 @@ func isDir(path string) bool {
// x/vendor/path, vendor/path, or else stay path if none of those exist. // x/vendor/path, vendor/path, or else stay path if none of those exist.
// VendoredImportPath returns the expanded path or, if no expansion is found, the original. // VendoredImportPath returns the expanded path or, if no expansion is found, the original.
func VendoredImportPath(parent *Package, path string) (found string) { func VendoredImportPath(parent *Package, path string) (found string) {
if DebugDeprecatedImportcfg.enabled {
if d, i := DebugDeprecatedImportcfg.lookup(parent, path); d != "" {
return i
}
return path
}
if parent == nil || parent.Root == "" { if parent == nil || parent.Root == "" {
return path return path
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment