Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 1 | Index: go/src/go/build/build.go |
| 2 | =================================================================== |
| 3 | --- go.orig/src/go/build/build.go |
| 4 | +++ go/src/go/build/build.go |
| 5 | @@ -1388,7 +1388,7 @@ func init() { |
| 6 | } |
| 7 | |
| 8 | // ToolDir is the directory containing build tools. |
| 9 | -var ToolDir = filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH) |
| 10 | +var ToolDir = envOr("GOTOOLDIR", filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)) |
| 11 | |
| 12 | // IsLocalImport reports whether the import path is |
| 13 | // a local import path, like ".", "..", "./foo", or "../foo". |
| 14 | Index: go/src/cmd/go/build.go |
| 15 | =================================================================== |
| 16 | --- go.orig/src/cmd/go/build.go |
| 17 | +++ go/src/cmd/go/build.go |
| 18 | @@ -1312,7 +1312,7 @@ func (b *builder) build(a *action) (err |
| 19 | } |
| 20 | |
| 21 | cgoExe := tool("cgo") |
| 22 | - if a.cgo != nil && a.cgo.target != "" { |
| 23 | + if a.cgo != nil && a.cgo.target != "" && os.Getenv("GOTOOLDIR") == "" { |
| 24 | cgoExe = a.cgo.target |
| 25 | } |
| 26 | outGo, outObj, err := b.cgo(a.p, cgoExe, obj, pcCFLAGS, pcLDFLAGS, cgofiles, gccfiles, cxxfiles, a.p.MFiles) |