summary refs log tree commit diff
path: root/pkgs/development/compilers/go/remove-tools-1.4.patch
blob: 807ab8e089c17412d8fbea3eb2d526cb1176225c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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".