Commit a921881f authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/dist: delete unnecessary dirs from GOROOT on completion

On my machine, these directories add up to 276mb
and account for 40% of the size of the GOROOT directory.

Once bootstrapping is complete, they are never used again.

Fixes #31851

Change-Id: Idbf8f21bae3d64655aa43761cc778677add6234a
Reviewed-on: https://go-review.googlesource.com/c/go/+/175377
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 0bf1f02e
...@@ -496,6 +496,7 @@ func setup() { ...@@ -496,6 +496,7 @@ func setup() {
xremoveall(p) xremoveall(p)
} }
xmkdirall(p) xmkdirall(p)
xatexit(func() { xremoveall(p) })
// Create tool directory. // Create tool directory.
// We keep it in pkg/, just like the object directory above. // We keep it in pkg/, just like the object directory above.
......
...@@ -128,6 +128,7 @@ func bootstrapBuildTools() { ...@@ -128,6 +128,7 @@ func bootstrapBuildTools() {
// but it is easier to debug on failure if the files are in a known location. // but it is easier to debug on failure if the files are in a known location.
workspace := pathf("%s/pkg/bootstrap", goroot) workspace := pathf("%s/pkg/bootstrap", goroot)
xremoveall(workspace) xremoveall(workspace)
xatexit(func() { xremoveall(workspace) })
base := pathf("%s/src/bootstrap", workspace) base := pathf("%s/src/bootstrap", workspace)
xmkdirall(base) xmkdirall(base)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment