Snapcraft go plugin install issues

Bug #1612741 reported by Jose L. VG
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Incomplete
Undecided
Unassigned

Bug Description

Trying to snap godoc I run into this golang bug:
https://github.com/golang/go/issues/15106

Sample run:

$ snapcraft
Preparing to pull godoc
Pulling godoc
go get -t -d golang.org/x/tools/cmd/godoc
Preparing to build godoc
Building godoc
go install golang.org/x/tools/cmd/godoc
go install golang.org/x/tools/cmd/godoc: open /usr/lib/go-1.6/bin/godoc: permission denied
Command '['/bin/sh', '/tmp/tmpws7rhnp0', 'go', 'install', 'golang.org/x/tools/cmd/godoc']' returned non-zero exit status 1

(See attached snapcraft.yaml)

Basically godoc is special and go install tries to put it in $GOROOT/bin instead of $GOPATH/bin

Even when when this is fixed in golang, snapcraft should NOT allow to install into $GOROOT or give the user a way out, like building without installing or forcing installation path within the snap environment.

Revision history for this message
Jose L. VG (josvaz) wrote :
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

What in the build process determines this should go into GOROOT instead of GOPATH?

Changed in snapcraft:
status: New → Incomplete
Revision history for this message
Jose L. VG (josvaz) wrote :

If you visit
https://github.com/golang/go/issues/15106

You can see the fix for go 1.7 here:
https://go-review.googlesource.com/#/c/21701/3/src/cmd/go/pkg.go

So the decision is hardwired in the go tooling binaries.

In any case, this bug report is about giving a more low level or granular way to compile go stuff so that you can decide to build diferently in case the go tooling does not do what you want.
Alternatively, the snapcraft go plgin should maybe clone the go build environment in a isolated build path so that changes are possible to it when needed.

I tested go 1.7 (by installing binaries, as we don't have it in xenial yet) and now you can snap godoc as it installs to $GOPATH.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.