英文:
gvm setting GOPATH in ubuntu 14.04
问题
我安装了gvm
和go1.3
,接下来该怎么做?我正在尝试构建Revel
,但是出现了以下错误:
无法加载包:在以下任何位置都找不到包“github.com/robfig/revel/cmd”:
/home/cnaize/.gvm/gos/go1.3/src/pkg/github.com/robfig/revel/cmd(来自$GOROOT)
($GOPATH未设置)
如何解决这个问题?
英文:
I installed gvm
with go1.3
, what next? I'm trying to build Revel
, but I have the error:
can't load package: package github.com/robfig/revel/cmd: cannot find package "github.com/robfig/revel/cmd" in any of:
/home/cnaize/.gvm/gos/go1.3/src/pkg/github.com/robfig/revel/cmd (from $GOROOT)
($GOPATH not set)
How to fix this?
答案1
得分: 3
你需要使用gvm
包和pkgset
来启用它。
gvm install go1.2.2
gvm use go1.2.2
gvm pkgset create revel-test
gvm pkgset use revel-test
go get github.com/reve/revel/cmd/revel
英文:
You need to enable the gvm
package with pkgset
gvm install go1.2.2
gvm use go1.2.2
gvm pkgset create revel-test
gvm pkgset use revel-test
go get github.com/reve/revel/cmd/revel
答案2
得分: 0
在安装了 GVM 后,可以使用以下命令来切换版本:
gvm use #version
请将 #version
替换为你想要使用的具体版本号。
英文:
after gvm install #version run:
gvm use #version
答案3
得分: -1
你需要通过运行以下命令来设置你的GOPATH
环境变量:
export GOPATH=/path/to/your/go/workspace
然后,使用以下命令获取包:
go get github.com/robfig/revel/cmd
注意,如果你在.bashrc
中设置了GOPATH
,你需要执行source ~/.bashrc
命令使其生效(或重新打开终端)。
我建议你在每次进行操作时,不仅仅是提问,还应该阅读一些关于Go的文档或教程。你可以在go标签描述中找到一些资源。
英文:
You have to set your GOPATH
environment variable by running a command like this
export GOPATH=/path/to/your/go/workspace
then get the package, by using the command
go get github.com/robfig/revel/cmd
Note if you set your GOPATH
in .bashrc
, you have to source ~/.bashrc
to make it effective the first time (or re-open your terminal).
I suggest you also read some documentation or tutorial about go instead of just creating a new question each time you do something. A list of resources is available on the go tag description.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论