1

When I try to install go tools I am getting permission denied for /usr/local/go/pkg/tool/linux_amd64/cover. I can accept that since it is /usr/local/ directory and need root access. But my first doubt is why it is trying to install at this location when I set GOPATH to some other location.

$ go version
go version go1.2.1 linux/amd64

$ export GOPATH='/home/vagrant/repos/atlantis-router/vendor'
$ go get code.google.com/p/go.tools/cmd/cover
go install code.google.com/p/go.tools/cmd/cover: open /usr/local/go/pkg/tool/linux_amd64/cover: permission denied

$ go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/vagrant/repos/atlantis-router/vendor"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
TERM="dumb"
CC="gcc"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
CXX="g++"
CGO_ENABLED="1"

Could anybody guide me solving this issue? What could be the reason?

brg
  • 7,332
  • 8
  • 44
  • 60

1 Answers1

1

Go tries to install that tool in $GOTOOLDIR, not $GOPATH, and as you can see it is set to /usr/local/go/pkg/tool/linux_amd64. Same thing happens to me here.

just run it with sudo, I guess, since there are other tools in that directory, and I think setting GOTOOLDIR to somewhere else might screw things up.

Not_a_Golfer
  • 40,006
  • 7
  • 115
  • 81