nixpkgs/pkgs/development/compilers/go/remove-tools-1.7.patch

36 lines
1.1 KiB
Diff
Raw Normal View History

2016-08-17 18:08:46 +00:00
diff --git a/src/go/build/build.go b/src/go/build/build.go
2016-09-11 18:21:40 +00:00
index 9706b8b..f250751 100644
2016-08-17 18:08:46 +00:00
--- a/src/go/build/build.go
+++ b/src/go/build/build.go
2016-09-11 18:21:40 +00:00
@@ -1513,7 +1513,7 @@ func init() {
2016-08-17 18:08:46 +00:00
}
// 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
2016-09-11 18:21:40 +00:00
index 441dcd9..a50277e 100644
2016-08-17 18:08:46 +00:00
--- a/src/runtime/extern.go
+++ b/src/runtime/extern.go
2016-09-11 18:21:40 +00:00
@@ -230,6 +230,17 @@ func GOROOT() string {
return sys.DefaultGoroot
2016-08-17 18:08:46 +00:00
}
+// 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".