Reputation: 2159
I have had some difficulties getting Go up and running correctly on Linux Mint 14. I have a folder ($HOME/develop/gocode) with bin
, pkg
and src
folders as my GOPATH
and have the GOPATH
environment variable set properly there. I tried installing a certain github repository using go get
(https://github.com/jbarham/primegen.go) but Go gave me the error: stat github.com/jbarham/primegen.go: no such file or directory
(I think because the repository ends in .go.) Fine, I just cloned it manually, but then when I try to go install
one of two executables in that repository (neither one works, but I tried installing primespeed first) I get the following error:
$ cd $GOPATH/src/github.com/jbarham/primegen.go/primespeed
$ go install
go install github.com/jbarham/primegen.go: mkdir /usr/lib/go/pkg/linux_amd64/github.com: permission denied
Why is go trying to install the package there? I've explicitly set my GOPATH
variable, and yet it is trying to install packages to /usr/local instead.
I'm not sure if it will help, but here is some other output regarding version and environment:
$ go env
GOROOT="/usr/lib/go"
GOBIN=""
GOARCH="amd64"
GOCHAR="6"
GOOS="linux"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
CGO_ENABLED="1"
$ go version
go version go1.0.2
Upvotes: 6
Views: 15169
Reputation: 109
I had the same issue, but found that, the for some repos you need to specifically add the export GOPATH
. for example from my GOPATH
cd $GOPATH
export GOPATH=$PWD && go get -d github.com/nsf/gocode
you could avoid it all together I guess, if you alias it:
alias goget='cd $GOPATH; export GOPATH=$PWD && go get'
This isn't perfect and oddly enough export GOPATH=$GOPATH
does not work.
for some reason some repos are resetting the GOPATH
to $HOME
and trying to execute as a different user.
My guess is some development code somewhere in the go get
method that is messing with the calls. [just a hunch, don't quote me]
Upvotes: 0
Reputation: 91193
.go
extension are not 'go gettable'.Ad 1. (better put into .bashrc or equivalent):
$ export GOPATH=$HOME # just an example
Ad 2. (better raise an issue about the nonsensical repository name):
$ mkdir -p $GOPATH/src/github.com/jbarham
$ cd $GOPATH/src/github.com/jbarham
$ git clone https://github.com/jbarham/primegen.go.git
$ cd primegen.go
$ go install
Upvotes: 5