diff options
author | Russ Cox <rsc@golang.org> | 2016-02-02 09:19:47 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2016-02-03 04:33:08 +0000 |
commit | 0ed70efc6b7ec096603c58f27c2668af3862bb3c (patch) | |
tree | b81475ba349209edef0325f6300a4f35315ecab4 /src/cmd/go/pkg.go | |
parent | 182a9db2dc57ec7da98391f8955d43b2e07fd40e (diff) | |
download | go-git-0ed70efc6b7ec096603c58f27c2668af3862bb3c.tar.gz |
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 <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/go/pkg.go')
-rw-r--r-- | src/cmd/go/pkg.go | 9 |
1 files changed, 6 insertions, 3 deletions
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)) } |