go install: 没有目录的安装位置

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

go install: no install location for directory

问题

我想我知道发生了什么。当我安装了gvm后,GOPATH发生了变化:

> alex@alex-K43U:~/go/src/m2k$ go install go install: no install
> location for directory /home/alex/go/src/m2k outside GOPATH
>
> alex@alex-K43U:~/go/src/m2k$ go env 
> GOPATH="/home/alex/.gvm/pkgsets/go1.4/global"
> GOROOT="/home/alex/.gvm/gos/go1.4"

现在我该怎么办?我担心将GOPATH带到我的工作场所会搞乱gvm。另一方面,go install不再起作用。

英文:

I think I know what's going on. The GOPATH changes when I installed gvm:

> alex@alex-K43U:~/go/src/m2k$ go install go install: no install
> location for directory /home/alex/go/src/m2k outside GOPATH
>
> alex@alex-K43U:~/go/src/m2k$ go env 
> GOPATH="/home/alex/.gvm/pkgsets/go1.4/global"
> GOROOT="/home/alex/.gvm/gos/go1.4"

What should I do know? I'm afraid that bringing the GOPATH to my workplace will mess up gvm. On the other hand, go install isn't working anymore.

答案1

得分: 3

你需要创建一个包集,它是一个封装的 $GOPATH 环境实例。

简而言之,可以使用任何你喜欢的名称;"test_pkgset" 只是一个示例名称:

gvm pkgset create test_pkgset
gvm pkgenv test_pkgset // 启动默认的 $EDITOR

export GOPATH; GOPATH=...export PATH; PATH=... 行的末尾修改为包括 $HOME/go:

export GOPATH; GOPATH="/home/alex/.gvm/pkgsets/go1.4/test_pkgset:$HOME/go:$GOPATH"
export PATH; PATH="/home/alex/.gvm/pkgsets/go1.4/test_pkgset/bin:${GVM_OVERLAY_PREFIX}/bin:$HOME/go/bin:${PATH}"

最后,使用它:

gvm pkgset use test_pkgset
英文:

You need to create a package set, which is for all intents an encapsulated $GOPATH environment instance.

In short, use whatever name you like; "test_pkgset" is just an example name:

gvm pkgset create test_pkgset
gvm pkgenv test_pkgset // Launches whatever $EDITOR defaults to

Change the end of export GOPATH; GOPATH=... and export PATH; PATH=... lines to include $HOME/go:

export GOPATH; GOPATH="/home/alex/.gvm/pkgsets/go1.4/test_pkgset:$HOME/go:$GOPATH"
export PATH; PATH="/home/alex/.gvm/pkgsets/go1.4/test_pkgset/bin:${GVM_OVERLAY_PREFIX}/bin:$HOME/go/bin:${PATH}"

Finally, use it:

gvm pkgset use test_pkgset

huangapple
  • 本文由 发表于 2015年2月25日 23:09:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/28722505.html
匿名

发表评论

匿名网友

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

确定