aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/development/compilers/go/remove-tools-1.4.patch
diff options
context:
space:
mode:
authorMx Kookie <kookie@spacekookie.de>2020-10-31 19:35:09 +0100
committerMx Kookie <kookie@spacekookie.de>2020-10-31 19:35:09 +0100
commitc4625b175f8200f643fd6e11010932ea44c78433 (patch)
treebce3f89888c8ac3991fa5569a878a9eab6801ccc /infra/libkookie/nixpkgs/pkgs/development/compilers/go/remove-tools-1.4.patch
parent49f735974dd103039ddc4cb576bb76555164a9e7 (diff)
parentd661aa56a8843e991261510c1bb28fdc2f6975ae (diff)
Add 'infra/libkookie/' from commit 'd661aa56a8843e991261510c1bb28fdc2f6975ae'
git-subtree-dir: infra/libkookie git-subtree-mainline: 49f735974dd103039ddc4cb576bb76555164a9e7 git-subtree-split: d661aa56a8843e991261510c1bb28fdc2f6975ae
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/development/compilers/go/remove-tools-1.4.patch')
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/compilers/go/remove-tools-1.4.patch81
1 files changed, 81 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/development/compilers/go/remove-tools-1.4.patch b/infra/libkookie/nixpkgs/pkgs/development/compilers/go/remove-tools-1.4.patch
new file mode 100644
index 000000000000..807ab8e089c1
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/development/compilers/go/remove-tools-1.4.patch
@@ -0,0 +1,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".