about summary refs log tree commit diff
path: root/pkgs/development/compilers/go/remove-tools-1.5.patch
blob: 00f4fac7476aade8607bcb0a1a2ca3570d58ca15 (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
diff --git a/src/cmd/go/pkg.go b/src/cmd/go/pkg.go
index 61e3d8d..f8475f4 100644
--- a/src/cmd/go/pkg.go
+++ b/src/cmd/go/pkg.go
@@ -665,7 +665,7 @@ var goTools = map[string]targetDir{
 	"cmd/asm":                              toTool,
 	"cmd/compile":                          toTool,
 	"cmd/cgo":                              toTool,
-	"cmd/cover":                            toTool,
+	"nixos.org/x/tools/cmd/cover":          toTool,
 	"cmd/dist":                             toTool,
 	"cmd/doc":                              toTool,
 	"cmd/fix":                              toTool,
@@ -676,9 +676,9 @@ var goTools = map[string]targetDir{
 	"cmd/pack":                             toTool,
 	"cmd/pprof":                            toTool,
 	"cmd/trace":                            toTool,
-	"cmd/vet":                              toTool,
+	"nixos.org/x/tools/cmd/vet":            toTool,
 	"cmd/yacc":                             toTool,
-	"golang.org/x/tools/cmd/godoc":         toBin,
+	"nixos.org/x/tools/cmd/godoc":          toBin,
 	"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 496fe11..8c81dbd 100644
--- a/src/go/build/build.go
+++ b/src/go/build/build.go
@@ -1388,7 +1388,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 d346362..fb22b6e 100644
--- a/src/runtime/extern.go
+++ b/src/runtime/extern.go
@@ -194,6 +194,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".