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
export GOPATH=$HOME/go
export GOBIN=$HOME/go/bin
try it.
.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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With