Commit 6cab8aa4 authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

cmd/go: fix handling of build tags for standard commands

Otherwise if I add '+build !race' to e.g. src/cmd/fix/reflect_test.go,
it does not work.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6642044
parent aa97c88e
...@@ -602,7 +602,7 @@ func loadPackage(arg string, stk *importStack) *Package { ...@@ -602,7 +602,7 @@ func loadPackage(arg string, stk *importStack) *Package {
} }
stk.push(arg) stk.push(arg)
defer stk.pop() defer stk.pop()
bp, err := build.ImportDir(filepath.Join(gorootSrc, arg), 0) bp, err := buildContext.ImportDir(filepath.Join(gorootSrc, arg), 0)
bp.ImportPath = arg bp.ImportPath = arg
bp.Goroot = true bp.Goroot = true
bp.BinDir = gorootBin bp.BinDir = gorootBin
...@@ -630,7 +630,7 @@ func loadPackage(arg string, stk *importStack) *Package { ...@@ -630,7 +630,7 @@ func loadPackage(arg string, stk *importStack) *Package {
// referring to io/ioutil rather than a hypothetical import of // referring to io/ioutil rather than a hypothetical import of
// "./ioutil". // "./ioutil".
if build.IsLocalImport(arg) { if build.IsLocalImport(arg) {
bp, _ := build.ImportDir(filepath.Join(cwd, arg), build.FindOnly) bp, _ := buildContext.ImportDir(filepath.Join(cwd, arg), build.FindOnly)
if bp.ImportPath != "" && bp.ImportPath != "." { if bp.ImportPath != "" && bp.ImportPath != "." {
arg = bp.ImportPath arg = bp.ImportPath
} }
......
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