cmd/go: don't fail on missing runtime/internal/sys/zversion.go

The generated file runtime/internal/sys/zversion.go is deleted by
`go tool cmd dist clean` as part of running clean.bash. Don't treat
a missing file as a reason to stop running the go tool; just treat
is as meaning that runtime/internal/sys is stale.

No test because I don't particularly want to clobber $GOROOT.

Fixes #20385.

Change-Id: I5251a99542cc93c33f627f133d7118df56e18af1
Reviewed-on: https://go-review.googlesource.com/43559
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Ian Lance Taylor 2017-05-16 18:02:56 -07:00
parent acc56909f2
commit c20e54533e

View file

@ -1644,7 +1644,10 @@ func computeBuildID(p *Package) {
// different build ID in each Go release.
if p.Standard && p.ImportPath == "runtime/internal/sys" && cfg.BuildContext.Compiler != "gccgo" {
data, err := ioutil.ReadFile(filepath.Join(p.Dir, "zversion.go"))
if err != nil {
if os.IsNotExist(err) {
p.Stale = true
p.StaleReason = fmt.Sprintf("missing zversion.go")
} else if err != nil {
base.Fatalf("go: %s", err)
}
fmt.Fprintf(h, "zversion %q\n", string(data))