Go包安装问题:没有安装位置

huangapple go评论86阅读模式
英文:

Go package install problems: No install location

问题

我正在尝试在Ubuntu上从源代码构建Packer,但是遇到了以下错误,我不确定如何解决。

go install: _/home/vagrant/packer/builder/amazon/chroot 没有安装位置
go install: _/home/vagrant/packer/builder/amazon/common 没有安装位置
go install: _/home/vagrant/packer/builder/amazon/ebs 没有安装位置
go install: _/home/vagrant/packer/builder/amazon/instance 没有安装位置
go install: _/home/vagrant/packer/builder/digitalocean 没有安装位置
go install: _/home/vagrant/packer/builder/openstack 没有安装位置
go install: _/home/vagrant/packer/builder/virtualbox 没有安装位置
go install: _/home/vagrant/packer/builder/vmware 没有安装位置
go install: _/home/vagrant/packer/command/build 没有安装位置
go install: _/home/vagrant/packer/command/fix 没有安装位置
go install: _/home/vagrant/packer/command/inspect 没有安装位置
go install: _/home/vagrant/packer/command/validate 没有安装位置
go install: _/home/vagrant/packer/common 没有安装位置
go install: _/home/vagrant/packer/common/command 没有安装位置
go install: _/home/vagrant/packer/common/json 没有安装位置
go install: _/home/vagrant/packer/communicator/ssh 没有安装位置
go install: _/home/vagrant/packer/packer 没有安装位置
go install: _/home/vagrant/packer/packer/plugin 没有安装位置
go install: _/home/vagrant/packer/packer/rpc 没有安装位置
go install: _/home/vagrant/packer/post-processor/vagrant 没有安装位置
go install: _/home/vagrant/packer/provisioner/chef-solo 没有安装位置
go install: _/home/vagrant/packer/provisioner/file 没有安装位置
go install: _/home/vagrant/packer/provisioner/puppet-masterless 没有安装位置
go install: _/home/vagrant/packer/provisioner/salt-masterless 没有安装位置
go install: _/home/vagrant/packer/provisioner/shell 没有安装位置
make: *** [all] Error 1

我尝试将上述几个目录添加到我的GOPATH中,但仍然遇到相同的错误。

$ echo $GOPATH
/home/vagrant/packer:/home/vagrant/packer/builder/amazon/chroot

英文:

I'm trying to build packer from source on ubuntu, but getting the following errors which I'm unsure how to resolve.

go install: no install location for _/home/vagrant/packer/builder/amazon/chroot
go install: no install location for _/home/vagrant/packer/builder/amazon/common
go install: no install location for _/home/vagrant/packer/builder/amazon/ebs
go install: no install location for _/home/vagrant/packer/builder/amazon/instance
go install: no install location for _/home/vagrant/packer/builder/digitalocean
go install: no install location for _/home/vagrant/packer/builder/openstack
go install: no install location for _/home/vagrant/packer/builder/virtualbox
go install: no install location for _/home/vagrant/packer/builder/vmware
go install: no install location for _/home/vagrant/packer/command/build
go install: no install location for _/home/vagrant/packer/command/fix
go install: no install location for _/home/vagrant/packer/command/inspect
go install: no install location for _/home/vagrant/packer/command/validate
go install: no install location for _/home/vagrant/packer/common
go install: no install location for _/home/vagrant/packer/common/command
go install: no install location for _/home/vagrant/packer/common/json
go install: no install location for _/home/vagrant/packer/communicator/ssh
go install: no install location for _/home/vagrant/packer/packer
go install: no install location for _/home/vagrant/packer/packer/plugin
go install: no install location for _/home/vagrant/packer/packer/rpc
go install: no install location for _/home/vagrant/packer/post-processor/vagrant
go install: no install location for _/home/vagrant/packer/provisioner/chef-solo
go install: no install location for _/home/vagrant/packer/provisioner/file
go install: no install location for _/home/vagrant/packer/provisioner/puppet-masterless
go install: no install location for _/home/vagrant/packer/provisioner/salt-masterless
go install: no install location for _/home/vagrant/packer/provisioner/shell
make: *** [all] Error 1

I've tried adding a few of the above directories to my GOPATH, but still get all the same errors above.

$ echo $GOPATH 
/home/vagrant/packer:/home/vagrant/packer/builder/amazon/chroot

答案1

得分: 3

GOPATH并不像你所认为的那样工作:它不是一个用于查找你要构建的代码的路径列表,而是指向你的Go工作区的路径。请先阅读http://golang.org/doc/code.html#Organization。你的GOPATH必须包含srcbinpkg目录,否则它就不是一个工作区。

错误信息试图告诉你的是:在你的GOPATH下没有pkg目录,因此go工具无法安装它正在尝试构建的内容。

英文:

GOPATH does not work like you assume: It is not a list of paths to look for your code you are trying to build but a path to your Go workspace. Please read http://golang.org/doc/code.html#Organization first. Your GOPATH must contain src, bin and pkg directories, otherwise it is not a workspace.

What the error message is trying to tell you: There is no pkg directory under your GOPATH, so the go tool cannot install what it is trying to build.

huangapple
  • 本文由 发表于 2013年10月7日 22:36:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/19227624.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定