英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论