nixpkgs/pkgs/development/compilers/go/remove-tools-1.4.patch
2015-08-19 13:25:44 -07:00

82 lines
2.8 KiB
Diff

diff --git a/misc/makerelease/makerelease.go b/misc/makerelease/makerelease.go
index 3b511b1..a46ebd8 100644
--- a/misc/makerelease/makerelease.go
+++ b/misc/makerelease/makerelease.go
@@ -65,9 +65,6 @@ const (
// These must be the command that cmd/go knows to install to $GOROOT/bin
// or $GOROOT/pkg/tool.
var toolPaths = []string{
- "golang.org/x/tools/cmd/cover",
- "golang.org/x/tools/cmd/godoc",
- "golang.org/x/tools/cmd/vet",
}
var preBuildCleanFiles = []string{
diff --git a/src/cmd/dist/build.c b/src/cmd/dist/build.c
index b6c61b4..2006bc2 100644
--- a/src/cmd/dist/build.c
+++ b/src/cmd/dist/build.c
@@ -210,7 +210,9 @@ init(void)
workdir = xworkdir();
xatexit(rmworkdir);
- bpathf(&b, "%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch);
+ xgetenv(&b, "GOTOOLDIR");
+ if (b.len == 0)
+ bpathf(&b, "%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch);
tooldir = btake(&b);
bfree(&b);
diff --git a/src/cmd/go/pkg.go b/src/cmd/go/pkg.go
index b71feb7..8468ea8 100644
--- a/src/cmd/go/pkg.go
+++ b/src/cmd/go/pkg.go
@@ -401,9 +401,9 @@ var goTools = map[string]targetDir{
"cmd/pack": toTool,
"cmd/pprof": toTool,
"cmd/yacc": toTool,
- "golang.org/x/tools/cmd/cover": toTool,
- "golang.org/x/tools/cmd/godoc": toBin,
- "golang.org/x/tools/cmd/vet": toTool,
+ "nixos.org/x/tools/cmd/cover": toTool,
+ "nixos.org/x/tools/cmd/godoc": toBin,
+ "nixos.org/x/tools/cmd/vet": toTool,
"code.google.com/p/go.tools/cmd/cover": stalePath,
"code.google.com/p/go.tools/cmd/godoc": stalePath,
"code.google.com/p/go.tools/cmd/vet": stalePath,
diff --git a/src/go/build/build.go b/src/go/build/build.go
index 311ecb0..f151d8f 100644
--- a/src/go/build/build.go
+++ b/src/go/build/build.go
@@ -1367,7 +1367,7 @@ func init() {
}
// ToolDir is the directory containing build tools.
-var ToolDir = filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
+var ToolDir = runtime.GOTOOLDIR()
// IsLocalImport reports whether the import path is
// a local import path, like ".", "..", "./foo", or "../foo".
diff --git a/src/runtime/extern.go b/src/runtime/extern.go
index 6cc5df8..9a9a964 100644
--- a/src/runtime/extern.go
+++ b/src/runtime/extern.go
@@ -152,6 +152,17 @@ func GOROOT() string {
return defaultGoroot
}
+// GOTOOLDIR returns the root of the Go tree.
+// It uses the GOTOOLDIR environment variable, if set,
+// or else the root used during the Go build.
+func GOTOOLDIR() string {
+ s := gogetenv("GOTOOLDIR")
+ if s != "" {
+ return s
+ }
+ return GOROOT() + "/pkg/tool/" + GOOS + "_" + GOARCH
+}
+
// Version returns the Go tree's version string.
// It is either the commit hash and date at the time of the build or,
// when possible, a release tag like "go1.3".