]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: set GOCACHE during make.bash/run.bash
authorRuss Cox <rsc@golang.org>
Wed, 1 Nov 2017 23:22:56 +0000 (19:22 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 2 Nov 2017 03:33:53 +0000 (03:33 +0000)
Use a build cache separate from the default user cache,
one that will be wiped out during startup, so that make.bash
continues to start from a clean slate.

Change-Id: I38733991015c66efb89fc170c71701b1dd9de28d
Reviewed-on: https://go-review.googlesource.com/75291
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
src/cmd/dist/build.go

index f0679be54c262f3e37fa8c38c4cb9a058e34e24c..04168d691c189b58aca64d96d57ed7e9e1329b29 100644 (file)
@@ -226,6 +226,11 @@ func xinit() {
        os.Setenv("GOROOT", goroot)
        os.Setenv("GOROOT_FINAL", goroot_final)
 
+       // Use a build cache separate from the default user one.
+       // Also one that will be wiped out during startup, so that
+       // make.bash really does start from a clean slate.
+       os.Setenv("GOCACHE", pathf("%s/pkg/obj/go-build", goroot))
+
        // Make the environment more predictable.
        os.Setenv("LANG", "C")
        os.Setenv("LANGUAGE", "en_US.UTF8")
@@ -428,14 +433,10 @@ func setup() {
        }
 
        // Create object directory.
-       // We keep it in pkg/ so that all the generated binaries
-       // are in one tree. If pkg/obj/libgc.a exists, it is a dreg from
-       // before we used subdirectories of obj. Delete all of obj
-       // to clean up.
-       if p := pathf("%s/pkg/obj/libgc.a", goroot); isfile(p) {
-               xremoveall(pathf("%s/pkg/obj", goroot))
-       }
-       p = pathf("%s/pkg/obj/%s_%s", goroot, gohostos, gohostarch)
+       // 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)
        if rebuildall {
                xremoveall(p)
        }