aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go/go-1.8/make-goroot-precious.patch
blob: 28a7a34773ecd6af77a9cb7024deb8ece57cfcb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Prevent GOROOT-resident packages from being rebuilt

Signed-off-by: Matt Madison <matt@madison.systems>
Upstream-Status: Pending

--- go.orig/src/cmd/go/pkg.go
+++ go/src/cmd/go/pkg.go
@@ -1496,6 +1496,13 @@ func isStale(p *Package) (bool, string)
 		return true, "build ID mismatch"
 	}
 
+	// For OE builds, make anything in GOROOT non-stale,
+	// to prevent a package build from overwriting the
+	// build root.
+	if p.Goroot && os.Getenv("GOROOT_OVERRIDE") != "1" {
+		return false, "GOROOT-resident packages do not get rebuilt"
+	}
+
 	// Package is stale if a dependency is.
 	for _, p1 := range p.deps {
 		if p1.Stale {