2

我正在尝试从 ubuntu 上的源代码构建打包程序,但出现以下错误,我不确定如何解决。

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

我尝试将上面的一些目录添加到我的 GOPATH 中,但仍然得到上面所有相同的错误。

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

1 回答 1

3

GOPATH 不像你想象的那样工作:它不是查找你正在尝试构建的代码的路径列表,而是你的 Go 工作区的路径。请先阅读http://golang.org/doc/code.html#Organization。您的 GOPATH必须包含src,binpkg目录,否则它不是工作空间。

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

于 2013-10-07T14:43:22.120 回答