1
0
mirror of https://github.com/golang/go synced 2024-09-29 20:14:29 -06:00

cmd/dist: fix a variable scope bug:

We reused p so we were deleting the same directory twice instead of two
different directories. Fix that.

For #47257

Change-Id: I315ad87d0a9182e00ae4c11b82986227e2b02e17
Reviewed-on: https://go-review.googlesource.com/c/go/+/447115
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
This commit is contained in:
Michael Matloob 2022-11-01 16:14:06 -04:00
parent 49bbece44c
commit 50c5919475

16
src/cmd/dist/build.go vendored
View File

@ -481,22 +481,22 @@ func setup() {
// We used to use it for C objects.
// Now we use it for the build cache, to separate dist's cache
// from any other cache the user might have.
p = pathf("%s/pkg/obj/go-build", goroot)
objGobuild := pathf("%s/pkg/obj/go-build", goroot)
if rebuildall {
xremoveall(p)
xremoveall(objGobuild)
}
xmkdirall(p)
xatexit(func() { xremoveall(p) })
xmkdirall(objGobuild)
xatexit(func() { xremoveall(objGobuild) })
// Create alternate driectory for intermediate
// standard library .a's to be placed rather than
// the final build's install locations.
p = pathf("%s/pkg/obj/go-bootstrap", goroot)
objGoBootstrap := pathf("%s/pkg/obj/go-bootstrap", goroot)
if rebuildall {
xremoveall(p)
xremoveall(objGoBootstrap)
}
xmkdirall(p)
xatexit(func() { xremoveall(p) })
xmkdirall(objGoBootstrap)
xatexit(func() { xremoveall(objGoBootstrap) })
// Create tool directory.
// We keep it in pkg/, just like the object directory above.