0

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?

cnaize
  • 3,139
  • 5
  • 27
  • 45
  • Can you try http://stackoverflow.com/a/21012349/749854 (are you unsing linux?) – nvcnvn Jun 19 '14 at 11:07
  • If you follow the above comment: Don't set GOROOT. It's already set. You will need to set (and export) GOPATH. – elithrar Jun 19 '14 at 11:18
  • my `bashrc` file looks like this `export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting [[ -s "/home/cnaize/.gvm/scripts/gvm" ]] && source "/home/cnaize/.gvm/scripts/gvm" export GOPATH=$HOME/Dropbox/develop/go export PATH=$PATH:$GOROOT/bin:$GOPATH/bin`, but it doesn't work – cnaize Jun 19 '14 at 11:22
  • Check this gvm issue: https://github.com/moovweb/gvm/issues/189 – goliatone Oct 06 '16 at 14:44

3 Answers3

3

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
fabrizioM
  • 46,639
  • 15
  • 102
  • 119
0

after gvm install #version run:

 gvm use #version
shacharsol
  • 2,326
  • 20
  • 14
  • 1
    You might also want to setup a default in case you haven't: gvm use go1.6.3 --default. It seem if you don't have a default set gvm will blank your GOPATH – goliatone Oct 06 '16 at 14:50
  • Thanks for adding the comment about using the `--default` flag, this was missing for me. – Kevin Wittek Feb 18 '17 at 12:18
-1

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.

Community
  • 1
  • 1
Elwinar
  • 9,103
  • 32
  • 40
  • I used to do this, but it doesn't work, that's why I've created this post – cnaize Jun 19 '14 at 11:57
  • Your error message distincly claim that `GOPATH` isn't set. So being by checking your `GOPATH`. – Elwinar Jun 19 '14 at 12:05
  • gvm will take over managing GOPATH as well, overriding whatever value you have defined in your environment. If you'd set your GOPATH in .bashrc and that was working, and now you are using gvm then "it doesn't work" makes sense. – goliatone Oct 06 '16 at 14:42