本文介绍了权限拒绝了'go.tools'的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试安装go工具时,我得到 / usr / local / go / pkg / tool / linux_amd64 / cover 的权限被拒绝。我可以接受,因为它是 / usr / local / 目录并且需要 root 访问。
但我的第一个疑问是,为什么当我将 GOPATH 设置到其他位置时,它试图在此位置安装。

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?

推荐答案

Go试图在 $ GOTOOLDIR ,而不是 $ GOPATH ,你可以看到它设置为 / usr / local / go / pkg / tool / linux_amd64

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.

使用sudo运行它,我想,因为该目录中还有其他工具,并且我认为将GOTOOLDIR设置到其他位置可能会将螺钉东西了。

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.

这篇关于权限拒绝了'go.tools'的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 01:39