Reputation: 8840
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?
Upvotes: 1
Views: 3114
Reputation: 1
seems like this is a common issue happens for so many users . so happened also to me ! the first step is to set your environment variables for Go by these commands :
echo export GOROOT=/usr/local/go >> ~/.bashrc
echo export GOPATH=\$HOME/go >> ~/.bashrc
echo export PATH=\$PATH:\$GOROOT/bin:\$GOPATH/bin >> ~/.bashrc
and then go has the accesses after that run this command so the system considers you as administrator:
sudo -s
then ctl+Shft+p and select Go: Instal/Upgrade tools
these steps worked for me :)
Upvotes: 0
Reputation: 49187
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.
Upvotes: 1