]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: don't fail on missing runtime/internal/sys/zversion.go
authorIan Lance Taylor <iant@golang.org>
Wed, 17 May 2017 01:02:56 +0000 (18:02 -0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 17 May 2017 01:30:51 +0000 (01:30 +0000)
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>
src/cmd/go/internal/load/pkg.go

index 52c2085ef5f0903246c4f1f667f518ea26b8f567..1a259a91bb35e5a2cdd7448576050f0b507a37d5 100644 (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))