Prevent GOROOT-resident packages from being rebuilt Signed-off-by: Matt Madison 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 {