go plugin: GOROOT env confuses snapcraft go

Bug #1537728 reported by Alexander Sack on 2016-01-25
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Medium
Unassigned

Bug Description

i dont think GOROOT or alike should cause side effects for go plugin projects that use their own downloaded go runtime etc. and have their own workspace to build the code...

asac@bigos:/tmp/snapcraft/examples/gopaste$ export GOROOT=/home/asac/non-existant
asac@bigos:/tmp/snapcraft/examples/gopaste$ ../../bin/snapcraft build
Pulling gopaste
From https://github.com/wisnij/gopaste
 * branch HEAD -> FETCH_HEAD
Already up-to-date.
env GOPATH=/tmp/snapcraft/examples/gopaste/parts/gopaste/go go get -t -d ./gopaste.git/...
go: cannot find GOROOT directory: /home/asac/non-existant
Command '['/bin/sh', '/tmp/tmpvnr6ul5r', 'env', 'GOPATH=/tmp/snapcraft/examples/gopaste/parts/gopaste/go', 'go', 'get', '-t', '-d', './gopaste.git/...']' returned non-zero exit status 2

Also if path exist it still causes troubles:
asac@bigos:/tmp/snapcraft/examples/gopaste$ export GOROOT=/home/asac/go/
asac@bigos:/tmp/snapcraft/examples/gopaste$ ../../bin/snapcraft build
Pulling gopaste
From https://github.com/wisnij/gopaste
 * branch HEAD -> FETCH_HEAD
Already up-to-date.
env GOPATH=/tmp/snapcraft/examples/gopaste/parts/gopaste/go go get -t -d ./gopaste.git/...
package bytes: unrecognized import path "bytes" (import path does not begin with hostname)
package database/sql: unrecognized import path "database/sql" (import path does not begin with hostname)
package flag: unrecognized import path "flag" (import path does not begin with hostname)
package fmt: unrecognized import path "fmt" (import path does not begin with hostname)
package math: unrecognized import path "math" (import path does not begin with hostname)
package reflect: unrecognized import path "reflect" (import path does not begin with hostname)
package sort: unrecognized import path "sort" (import path does not begin with hostname)
package strings: unrecognized import path "strings" (import path does not begin with hostname)
package sync: unrecognized import path "sync" (import path does not begin with hostname)
package database/sql/driver: unrecognized import path "database/sql/driver" (import path does not begin with hostname)
package errors: unrecognized import path "errors" (import path does not begin with hostname)
package io: unrecognized import path "io" (import path does not begin with hostname)
package net/url: unrecognized import path "net/url" (import path does not begin with hostname)
package runtime: unrecognized import path "runtime" (import path does not begin with hostname)
package strconv: unrecognized import path "strconv" (import path does not begin with hostname)
package time: unrecognized import path "time" (import path does not begin with hostname)
package unsafe: unrecognized import path "unsafe" (import path does not begin with hostname)
package html/template: unrecognized import path "html/template" (import path does not begin with hostname)
package log: unrecognized import path "log" (import path does not begin with hostname)
package math/rand: unrecognized import path "math/rand" (import path does not begin with hostname)
package net/http: unrecognized import path "net/http" (import path does not begin with hostname)
package os: unrecognized import path "os" (import path does not begin with hostname)
package path/filepath: unrecognized import path "path/filepath" (import path does not begin with hostname)
package regexp: unrecognized import path "regexp" (import path does not begin with hostname)
Command '['/bin/sh', '/tmp/tmptkwztlze', 'env', 'GOPATH=/tmp/snapcraft/examples/gopaste/parts/gopaste/go', 'go', 'get', '-t', '-d', './gopaste.git/...']' returned non-zero exit status 1

Kyle Fazzari (kyrofa) wrote :

Fix was not satisfactory. The ideal fix to this is cleanbuild, which will be completed soon.

Leo Arias (elopio) wrote :

We have cleanbuild now. But it's pretty common for go developers to have GOROOT set.
Is it really the only option for them to use a lxd to build? We should have a strong reason for that.
And if so, the go plugin should catch when GOROOT is set and suggest to use LXD, instead of this weird error.

So I'm leaving this open.

no longer affects: snapcraft/trunk
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers