How to manually specify the location of Go

Bug #1618720 reported by Cheng Lu
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Snapcraft
Won't Fix
Undecided
Unassigned

Bug Description

The related bug is "#1616985 the go plugin doesn't support go 1.7 "

But I have one more question, how to manually specify the location of Go?
I installed Go manually as the installation instructions from https://golang.org/doc/install . NOT using APT.

My `go env` are:
---
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/dawndiy/workspace/golang"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build773337785=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
---

When I try to build a snap package for my go project using plugin go, it said "Installing build dependencies: golang-go", and request to install "golang-go" package.

I checked the source code of snapcraft on github. I found this line:
https://github.com/snapcore/snapcraft/blob/2.15.1/snapcraft/plugins/go.py#L103
'self.build_packages.append('golang-go')'
This line add 'golang-go' as a dependent package.

So my temporary solution is comment this line, and snapcraft will use Go that I installed manually.

Tags: plugin
Revision history for this message
Chris Glass (tribaal) wrote :

I've hit the issue while trying to snap a program that requires golang 1.8 (and my golang-go package installs 1.7).

I have submitted a pull request that installs golang conditionally, based on whether "go" is available in PATH or not:

https://github.com/snapcore/snapcraft/pull/1362

Revision history for this message
Kyle Fazzari (kyrofa) wrote :

Snapcraft is moving in the direction of reproducible builds. Manually depending on a toolchain on the developer's computer goes against this goal. The real issue here is building a snap that requires a newer golang than what is available in the archives. Our current recommended way of doing that is to use the remote `go` part, but we're hoping to implement a `build-snaps` directive soon that will use the golang snap instead of the deb.

Changed in snapcraft:
status: New → Won't Fix
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.