Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

cmd/gb: verify the Go install has not changed #321

Merged
merged 1 commit into from
Aug 23, 2015
Merged

Conversation

davecheney
Copy link
Contributor

Update #319

This PR adds a check to attempt to diagnose gb failures due to a mismatch between the version of Go that compiled gb, and the version of Go that exists on the machine when gb is invoked.

I expect it will cause some false positives, and if so, we'll address them or remove the check.

% gb build
FATAL Go version does not match: gb was compiled with "devel +fa87cf8 Wed Aug 19 04:36:55 2015 +0000", installed Go version from /home/dfc/go is "devel +8ca7856 Sat Aug 22 18:39:29 2015 +0000"

davecheney added a commit that referenced this pull request Aug 23, 2015
cmd/gb: verify the Go install has not changed
@davecheney davecheney merged commit 34bdc62 into master Aug 23, 2015
@davecheney davecheney deleted the add-goroot-check branch August 23, 2015 07:11
@tianon
Copy link
Member

tianon commented Aug 23, 2015

Not sure if it warrants opening a new issue (although happy to do so if you think I ought), but this causes failures on Gentoo due to VERSION not being installed in GOROOT:

$ go version
go version go1.4.2 linux/amd64
$ go env GOROOT
/usr/lib/go
$ ls -lAFh /usr/lib/go
total 24K
drwxr-xr-x  3 root root 4.0K Apr  4 13:24 4.8.4/
drwxr-xr-x  8 root root 4.0K Mar 19 23:02 doc/
drwxr-xr-x  3 root root 4.0K Mar 19 23:02 include/
drwxr-xr-x  3 root root 4.0K Dec 16  2013 lib/
drwxr-xr-x  5 root root 4.0K Oct  9  2013 pkg/
drwxr-xr-x 46 root root 4.0K Mar 19 23:02 src/

@davecheney
Copy link
Contributor Author

I knew there would be one distro that would mes this up.

I think it is a mistake that gentoo filter the installed contents of
GOROOT. What are the chances of getting you to raise the bug against them,
not gb?
On 24 Aug 2015 8:38 am, "Tianon Gravi" notifications@github.com wrote:

Not sure if it warrants opening a new issue (although happy to do so if
you think I ought), but this causes failures on Gentoo due to VERSION not
being installed in GOROOT:

$ go versiongo version go1.4.2 linux/amd64
$ go env GOROOT/usr/lib/go
$ ls -lAFh /usr/lib/gototal 24Kdrwxr-xr-x 3 root root 4.0K Apr 4 13:24 4.8.4/drwxr-xr-x 8 root root 4.0K Mar 19 23:02 doc/drwxr-xr-x 3 root root 4.0K Mar 19 23:02 include/drwxr-xr-x 3 root root 4.0K Dec 16 2013 lib/drwxr-xr-x 5 root root 4.0K Oct 9 2013 pkg/drwxr-xr-x 46 root root 4.0K Mar 19 23:02 src/


Reply to this email directly or view it on GitHub
#321 (comment).

@tianon
Copy link
Member

tianon commented Aug 23, 2015

Heh, I'm not opposed, but to be honest also not completely convinced. Is there a good reference anywhere about what's expected to live in GOROOT? I don't think I've ever seen one -- just assumptions here and there (like the GOROOT_BOOTSTRAP code assuming that GOROOT/bin/go exists, for example, which Debian had to work around for gccgo). It is worth noting that Debian does install the VERSION file in GOROOT, but I've always understood go version to be the canonical method of fetching the "current Go version" (or runtime.Version).

Do you think there'd be any chance at all of convincing Go upstream to clearly document the things expected to exist in GOROOT so we could use that as leverage? As one of the packagers for Go in Debian, I know I'd personally really appreciate an official document like that, and I don't think I'd be alone in appreciation of that (and that would make it really hard to argue that this is a gb bug and not a Go packaging bug).

@davecheney
Copy link
Contributor Author

My hope is I can get upstream to adopt this method of detecting go install
mismatches as people setting GOROOT and forgetting it has been a continual
problem for the last four years.

If I am successful in that, the proposal will include the requirement that
VERSION is present.
On 24 Aug 2015 9:13 am, "Tianon Gravi" notifications@github.com wrote:

Heh, I'm not opposed, but to be honest also not completely convinced.
Is there a good reference anywhere about what's expected to live in GOROOT?
I don't think I've ever seen one -- just assumptions here and there (like
the GOROOT_BOOTSTRAP code assuming that GOROOT/bin/go exists, for
example, which Debian had to work around for gccgo). It is worth noting
that Debian does install the VERSION file in GOROOT, but I've always
understood go version to be the canonical method of fetching the "current
Go version" (or runtime.Version).

Do you think there'd be any chance at all of convincing Go upstream to
clearly document the things expected to exist in GOROOT so we could use
that as leverage? As one of the packagers for Go in Debian, I know I'd
personally really appreciate an official document like that, and I don't
think I'd be alone in appreciation of that (and that would make it really
hard to argue that this is a gb bug and not a Go packaging bug).


Reply to this email directly or view it on GitHub
#321 (comment).

@tianon
Copy link
Member

tianon commented Aug 24, 2015

That would definitely be very interesting! 👍

I've done a little digging, and found this gem: https://bugs.debian.org/693186

Apparently, go tool dist doesn't work without $GOROOT/VERSION. 😈

@tianon
Copy link
Member

tianon commented Aug 24, 2015

@davecheney
Copy link
Contributor Author

Thanks. I appreciate that someone else gets to hold this hot potato for a
time.

On Tue, Aug 25, 2015 at 4:11 AM, Tianon Gravi notifications@github.com
wrote:

https://bugs.gentoo.org/show_bug.cgi?id=558620 [image: 😉] [image:
❤️]


Reply to this email directly or view it on GitHub
#321 (comment).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants