构建打包程序会导致权限被拒绝错误 [英] Building packer causes permission denied error

查看:197
本文介绍了构建打包程序会导致权限被拒绝错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建打包工具,并收到此错误消息:

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

安装程序是否尝试访问我的/ usr文件夹?我应该在根目录下运行它吗?如何解决这个问题?

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

推荐答案

go vet 这是一个需要进入GOROOT的工具。在大多数安装中,GOROOT也是用户可写的,但是如果您是通过软件包管理器安装的,它不会是。

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.

要解决此问题,可以以root身份执行此操作避免更改GOPATH中的任何权限:

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

由于 vet 是官方发行版提供的工具,没有安装它可能被认为是gentoo的 go 包中的一个错误。官方 go 二进制发行版包含以下工具:

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

这篇关于构建打包程序会导致权限被拒绝错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆