How to manually specify the location of Go
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:/
My `go env` are:
---
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=
GORACE=""
GOROOT=
GOTOOLDIR=
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-
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:/
'self.build_
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.
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