···1-diff --git a/src/go/build/build.go b/src/go/build/build.go
2-index 9706b8b..f250751 100644
3---- a/src/go/build/build.go
4-+++ b/src/go/build/build.go
5-@@ -1513,7 +1513,7 @@ func init() {
6- }
7-8- // ToolDir is the directory containing build tools.
9--var ToolDir = filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
10-+var ToolDir = runtime.GOTOOLDIR()
11-12- // IsLocalImport reports whether the import path is
13- // a local import path, like ".", "..", "./foo", or "../foo".
14-diff --git a/src/runtime/extern.go b/src/runtime/extern.go
15-index 441dcd9..a50277e 100644
16---- a/src/runtime/extern.go
17-+++ b/src/runtime/extern.go
18-@@ -230,6 +230,17 @@ func GOROOT() string {
19- return sys.DefaultGoroot
20- }
21-22-+// GOTOOLDIR returns the root of the Go tree.
23-+// It uses the GOTOOLDIR environment variable, if set,
24-+// or else the root used during the Go build.
25-+func GOTOOLDIR() string {
26-+ s := gogetenv("GOTOOLDIR")
27-+ if s != "" {
28-+ return s
29-+ }
30-+ return GOROOT() + "/pkg/tool/" + GOOS + "_" + GOARCH
31-+}
32-+
33- // Version returns the Go tree's version string.
34- // It is either the commit hash and date at the time of the build or,
35- // when possible, a release tag like "go1.3".