]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: fix a variable scope bug:
authorMichael Matloob <matloob@golang.org>
Tue, 1 Nov 2022 20:14:06 +0000 (16:14 -0400)
committerMichael Matloob <matloob@golang.org>
Tue, 1 Nov 2022 20:46:55 +0000 (20:46 +0000)
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>
src/cmd/dist/build.go

index 605ef52e96923c00cbfb413451d0ae3732df9b12..dfa67290fa68421296206c9cd3c784704272ecd9 100644 (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.
-       = 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.
-       = 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.