From: Joel Sing Date: Wed, 26 Sep 2012 14:00:50 +0000 (+1000) Subject: cmd/go: assume that code in $GOROOT is up to date X-Git-Tag: go1.1rc2~2319 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e80fccb441ac73a206bd99fb7f0dbea3eb9cc149;p=gostls13.git cmd/go: assume that code in $GOROOT is up to date Do not check compiler/linker timestamps for packages that are in the $GOROOT. Avoids trying to rebuild non-writable standard packages when timestamps have not been retained on the Go binaries. Fixes #4106. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/6533053 --- diff --git a/src/cmd/go/pkg.go b/src/cmd/go/pkg.go index 94f01aab05..e9f344ff91 100644 --- a/src/cmd/go/pkg.go +++ b/src/cmd/go/pkg.go @@ -521,14 +521,19 @@ func isStale(p *Package, topRoot map[string]bool) bool { // As a courtesy to developers installing new versions of the compiler // frequently, define that packages are stale if they are // older than the compiler, and commands if they are older than - // the linker. This heuristic will not work if the binaries are back-dated, - // as some binary distributions may do, but it does handle a very - // common case. See issue 3036. - if olderThan(buildToolchain.compiler()) { - return true - } - if p.build.IsCommand() && olderThan(buildToolchain.linker()) { - return true + // the linker. This heuristic will not work if the binaries are + // back-dated, as some binary distributions may do, but it does handle + // a very common case. + // See issue 3036. + // Assume code in $GOROOT is up to date, since it may not be writeable. + // See issue 4106. + if p.Root != goroot { + if olderThan(buildToolchain.compiler()) { + return true + } + if p.build.IsCommand() && olderThan(buildToolchain.linker()) { + return true + } } // Have installed copy, probably built using current compilers,