gvm在ubuntu 14.04中设置GOPATH

时间:2014-06-19 10:47:29

标签: go revel gvm

我用gvm安装了go1.3,下一步是什么?我正在尝试构建Revel,但我有错误:

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)

如何解决这个问题?

3 个答案:

答案 0 :(得分: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

答案 1 :(得分:0)

在gvm install #version之后运行:

 gvm use #version

答案 2 :(得分:-1)

您必须通过运行类似

的命令来设置GOPATH环境变量
export GOPATH=/path/to/your/go/workspace

然后使用命令

获取包
go get github.com/robfig/revel/cmd

请注意,如果您将GOPATH设置为.bashrc,则必须source ~/.bashrc才能使其首次生效(或重新打开您的终端)。

我建议你也阅读一些关于go的文档或教程,而不是每次做某事时都创建一个新问题。 go tag description上提供了资源列表。

相关问题