2014-09-18 11:18:45 +02:00
|
|
|
Index: go/src/cmd/go/pkg.go
|
|
|
|
===================================================================
|
|
|
|
--- go.orig/src/cmd/go/pkg.go
|
|
|
|
+++ go/src/cmd/go/pkg.go
|
2015-12-22 15:58:30 +01:00
|
|
|
@@ -781,7 +781,13 @@ func (p *Package) load(stk *importStack,
|
2014-09-18 11:18:45 +02:00
|
|
|
if goTools[p.ImportPath] == toTool {
|
|
|
|
// This is for 'go tool'.
|
|
|
|
// Override all the usual logic and force it into the tool directory.
|
|
|
|
- p.target = filepath.Join(gorootPkg, "tool", full)
|
|
|
|
+ // If GOROOT_TARGET is set, then write to it for packaging purpose
|
|
|
|
+ gorootTarget := os.Getenv("GOROOT_TARGET")
|
|
|
|
+ if gorootTarget == "" {
|
|
|
|
+ p.target = filepath.Join(gorootPkg, "tool", full)
|
|
|
|
+ } else {
|
|
|
|
+ p.target = filepath.Join(gorootTarget, "pkg/tool", full)
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
if p.target != "" && buildContext.GOOS == "windows" {
|
|
|
|
p.target += ".exe"
|