From 0ed70efc6b7ec096603c58f27c2668af3862bb3c Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 2 Feb 2016 09:19:47 -0500 Subject: cmd/go: fix rebuild after installation of new Go release The loading of zversion.go was expecting it to be in package runtime, but it moved to runtime/internal/sys. Worse, the load was not checking the error. Update the path, check the error, add a test. Fixes #14176. Change-Id: I203c40afe1448875581415d5e42c29f09b14545d Reviewed-on: https://go-review.googlesource.com/19180 Run-TryBot: Russ Cox Reviewed-by: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- src/cmd/go/pkg.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/cmd/go/pkg.go') diff --git a/src/cmd/go/pkg.go b/src/cmd/go/pkg.go index 95a06ffedc..a804ccd277 100644 --- a/src/cmd/go/pkg.go +++ b/src/cmd/go/pkg.go @@ -1542,11 +1542,14 @@ func computeBuildID(p *Package) { fmt.Fprintf(h, "file %s\n", file) } - // Include the content of runtime/zversion.go in the hash + // Include the content of runtime/internal/sys/zversion.go in the hash // for package runtime. This will give package runtime a // different build ID in each Go release. - if p.Standard && p.ImportPath == "runtime" { - data, _ := ioutil.ReadFile(filepath.Join(p.Dir, "zversion.go")) + if p.Standard && p.ImportPath == "runtime/internal/sys" { + data, err := ioutil.ReadFile(filepath.Join(p.Dir, "zversion.go")) + if err != nil { + fatalf("go: %s", err) + } fmt.Fprintf(h, "zversion %q\n", string(data)) } -- cgit v1.2.1