kikito
kikito

Reputation: 52641

go - Instructions for installing from the ubuntu ppa

I've installed golang-stable using the Go Language ppa for Ubuntu.

The Official Installation Instructions seem to ignore this option, and don't mention it at all.

My question is: does anyone know if anything else is needed after doing the sudo apt-get for this package? In particular, do I have to manually set any environment variables?

I'm asking because I've been able to "go get" Go-SDL, but when I try to execute its test I get the following error:

$ ./test
panic: No such environment variable: GOPATH

This kind of confuses me. Shouldn't that variable be initialized already? Especially given that I have been able to compile and install a library.

Upvotes: 2

Views: 4892

Answers (1)

user811773
user811773

Reputation:

The go command that you installed in /usr/lib/go/bin/ internally contains a default path that is used if the environment variable GOPATH is missing. In case of the Ubuntu package this default path points to /usr/lib/go. Thus the installation directory for Go-SDL is somewhere in /usr/lib/go/src. Installing Go-SDL in this way requires root priviledges.

I recommend you setup GOPATH as described in http://golang.org/doc/code.html and reinstall Go-SDL. For example:

# Uninstall Go-SDL from /usr/lib/go
sudo go clean -i github.com/0xe2-0x9a-0x9b/Go-SDL/...

# Setup GOPATH
mkdir -p $HOME/go/src
export GOPATH=$HOME/go

# Install Go-SDL into $GOPATH
go get -v github.com/0xe2-0x9a-0x9b/Go-SDL/...

The test from github.com/0xe2-0x9a-0x9b/Go-SDL needs to know GOPATH to find some resource files (based on How to access resource files after the 'go' tool installed the executable?).

Upvotes: 5

Related Questions