Building packer causes permission denied error

杀马特。学长 韩版系。学妹 提交于 2019-12-12 03:21:49

问题


I am trying to build packer and I am getting this error:

go install golang.org/x/tools/cmd/vet: open /usr/lib/go/pkg/tool/linux_amd64/vet: permission denied
Makefile:40: recipe for target 'test' failed
make: *** [test] Error 1

Is the installer trying to access my /usr folder? Should I run this under root? How can I fix this?


回答1:


go vet is special, in that it's a tool that needs to go in GOROOT. In most installations GOROOT is also user writable, but if you installed via a package manager it won't be.

To work around this, you can do this as root to avoid changing any permissions in your GOPATH:

GOPATH=/tmp/tmpGOPATH go get golang.org/x/tools/cmd/vet
rm -rf /tmp/tmpGOPATH

Since vet is a tool provided by the official distribution, not having it installed may be considered a bug in gentoo's go package. The official go binary distribution included the following tools:

addr2line
api
asm
cgo
compile
cover
dist
doc
fix
link
nm
objdump
pack
pprof
tour
trace
vet
yacc


来源:https://stackoverflow.com/questions/33403883/building-packer-causes-permission-denied-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!