summary refs log tree commit diff
path: root/pkgs/development/compilers/go/remove-tools-1.9.patch
diff options
context:
space:
mode:
authorCharles Strahan <charles@cstrahan.com>2017-09-05 16:24:41 -0400
committerCharles Strahan <charles@cstrahan.com>2017-09-05 16:44:13 -0400
commit3189b016470f68ccae2b76d0a15a5ccd4c60b523 (patch)
treefe44fc86fcad9398d3fb90496c87cb7fc311f60d /pkgs/development/compilers/go/remove-tools-1.9.patch
parent8706664ff69444ed1d576250901a4d45cb17c690 (diff)
downloadnixlib-3189b016470f68ccae2b76d0a15a5ccd4c60b523.tar
nixlib-3189b016470f68ccae2b76d0a15a5ccd4c60b523.tar.gz
nixlib-3189b016470f68ccae2b76d0a15a5ccd4c60b523.tar.bz2
nixlib-3189b016470f68ccae2b76d0a15a5ccd4c60b523.tar.lz
nixlib-3189b016470f68ccae2b76d0a15a5ccd4c60b523.tar.xz
nixlib-3189b016470f68ccae2b76d0a15a5ccd4c60b523.tar.zst
nixlib-3189b016470f68ccae2b76d0a15a5ccd4c60b523.zip
go: init 1.9 (and set as default)
Diffstat (limited to 'pkgs/development/compilers/go/remove-tools-1.9.patch')
-rw-r--r--pkgs/development/compilers/go/remove-tools-1.9.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/pkgs/development/compilers/go/remove-tools-1.9.patch b/pkgs/development/compilers/go/remove-tools-1.9.patch
new file mode 100644
index 000000000000..e76ed61693a8
--- /dev/null
+++ b/pkgs/development/compilers/go/remove-tools-1.9.patch
@@ -0,0 +1,35 @@
+diff --git a/src/go/build/build.go b/src/go/build/build.go
+index d8163d0172..dd80a70473 100644
+--- a/src/go/build/build.go
++++ b/src/go/build/build.go
+@@ -1592,7 +1592,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 6e6c674d96..e9f62f96dc 100644
+--- a/src/runtime/extern.go
++++ b/src/runtime/extern.go
+@@ -223,6 +223,17 @@ func GOROOT() string {
+ 	return sys.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".