-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Golang-1.10 GOROOT requires manual export on Ubuntu Xenial #25421
Comments
This is an issue with the debian package itself. Go distributions expect they will be installed in From the docs - https://golang.org/doc/install
|
You should not need to set GOROOT. However this project does not manage the Ubuntu and Debian packages. You will have to raise the issue with them. Sorry.
… On 16 May 2018, at 20:23, (Holloway) Chew, Kean Ho ***@***.***> wrote:
What version of Go are you using (go version)?
go version go1.10 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN="/home/holloway/bin"
GOCACHE="/home/holloway/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/holloway"
GORACE=""
GOROOT="/usr/lib/go-1.10"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.10/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build607283709=/tmp/go-build -gno-record-gcc-switches"
Ubuntu Xenial (Vanila)
http://ppa.launchpad.net/gophers/archive/ubuntu xenial main
What did you do?
$ sudo add-apt-repository ppa:gophers/archive
$ sudo apt update -y
$ sudo apt install golang-1.10 -y
$ export PATH="/usr/lib/go-1.10/bin:$PATH"
$ vi <a poor go source code> # save it and let go metalinter to perform validation
securekey_test.go|6 col 2 warning| unused struct field could not import testing (cannot find package "testing" in any of: (structcheck)
securekey_test.go|34 col 4 warning| unused struct field invalid operation: t (variable of type *invalid type) has no field or method Errorf (structcheck)
securekey_test.go|38 col 3 warning| unused struct field invalid operation: t (variable of type *invalid type) has no field or method Logf (structcheck)
securekey_test.go|6 col 2 warning| unused variable or constant could not import testing (cannot find package "testing" in any of: (varcheck)
securekey_test.go|41 col 4 warning| unused struct field invalid operation: t (variable of type *invalid type) has no field or method Errorf (structcheck)
securekey_test.go|34 col 4 warning| unused variable or constant invalid operation: t (variable of type *invalid type) has no field or method Errorf (varcheck)
securekey_test.go|66 col 3 warning| unused struct field invalid operation: t (variable of type *invalid type) has no field or method Logf (structcheck)
securekey_test.go|38 col 3 warning| unused variable or constant invalid operation: t (variable of type *invalid type) has no field or method Logf (varcheck)
securekey_test.go|72 col 4 warning| unused struct field invalid operation: t (variable of type *invalid type) has no field or method Errorf (structcheck)
securekey_test.go|41 col 4 warning| unused variable or constant invalid operation: t (variable of type *invalid type) has no field or method Errorf (varcheck)
securekey_test.go|95 col 3 warning| unused struct field invalid operation: t (variable of type *invalid type) has no field or method Logf (structcheck)
$ export GOROOT="/usr/lib/go-1.10"
$ export PATH="$GOROOT/bin:$PATH"
$ vi <the same poor go source code> # save it to let go metalinter to perform validation
# no more error
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
Follow all the $ commands in the above
What did you expect to see?
Go 1.10 is setup correctly, with GOROOT properly exported after installation. User only need to set GOPATH, GOBIN etc.
What did you see instead?
Need to set and export GOROOT explicitly to ensure the the standard packages are found.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@davecheney, noted. Appreciate if this ticket to be reopened until I've transfer the ticket to launchpad please? I'll close the ticket once the transfer is completed. NOTE: I'm not the only person facing the issue. |
After working with Michael Hudson-Doyle, the ppa maintainer. We found that this issue is completely not related to the deb package.
Since the guide in https://github.com/golang/go/wiki/Ubuntu only spells how to install but not on how to update, I'll list the notes here in case any ubuntu user wants to update their golang in the future. $ sudo apt update -y
$ sudo apt remove golang1.X # old version
$ sudo apt install golang1.Y # new version
$ export PATH="/usr/lib/go-1.Y/bin:$PATH" # to get go and gofmt into your bin list
$ export GOROOT="/usr/lib/go-1.Y" # temporary for mass update.
$ go get -u "$GOPATH/src/..." # update all packages This should prevent any future metalinter or linter issue that cause this problem at the first place. |
I’m sorry, you still don’t need to set goroot, that advice is wrong and likely covering up the actual root cause.
… On 19 May 2018, at 15:14, (Holloway) Chew, Kean Ho ***@***.***> wrote:
After working with Michael Hudson-Doyle, the ppa maintainer. We found that this issue is completely not related to the deb package.
the metalinter issue was caused by the metalinter package itself, and it requires ***@***.*** which was committed 11 days ago from this post. Updating the metalinter package with that commit will solve the issue.
Unknown issue with go get -u. I'm no longer be able to reproduce the issue with go get update after performing a mass package update go get -u $GOPATH/src/..., including the issue above.
Since the guide in https://github.com/golang/go/wiki/Ubuntu only spells how to install but not on how to update, I'll list the notes here in case any ubuntu user wants to update their golang in the future.
$ sudo apt remove golang1.X # old version
$ sudo apt update -y
$ sudo apt install golang1.Y # new version
$ export PATH="/usr/lib/golang-1.Y/bin:$PATH" # to get go and gofmt into your bin list
$ export GOROOT="/usr/lib/golang-1.Y" # temporarily for mass update.
$ go get -u "$GOPATH/src/..." # update all packages
This should prevent any future metalinter or linter issue that cause this problem at the first place.
Restart your terminal without the export GOROOT. Your go should be fine.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@davecheney, the export listed here is meant for problem No. 2, and for other 3rd party packages carrying the same issue like metalinter did (until they fix the problem). I'm currently using However, I disagree not to export |
I wonder if you have 2 different versions of Go and a mismatch between GOPATH and GOROOT.
|
What version of Go are you using (
go version
)?go version go1.10 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
Follow all the $ commands in the above
What did you expect to see?
Go 1.10 is setup correctly, with
GOROOT
properly exported after installation. User only need to setGOPATH
,GOBIN
etc.What did you see instead?
Need to set and export
GOROOT
explicitly to ensure the the standard packages are found.The text was updated successfully, but these errors were encountered: