gvm setting GOPATH in ubuntu 14.04

5.2k Views Asked by At

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?

3

There are 3 best solutions below

2
On

after gvm install #version run:

 gvm use #version
3
On

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.

1
On

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