Last Updated: February 25, 2016
·
2.218K
· makenowjust

How do you manage Go's version? - Let's use GoVM!

What

I want to manage version of Go. So I was thinking of using gvm, but gvm has some problems:

  • gvm and gvm may conflict, because they have same name commands.
  • gvm can't work on Windows. I'm Windows user.

Thus and so I created GoVM. This article will explain how to use GoVM.

Install GoVM

If you had installed Python (version 2.x) and Git, then it is so easy (not the case, you should download this tools). Run to install (this command works on windows and linux!):

$ python -c "import urllib2; print urllib2.urlopen('http://git.io/govm').read()" | python - setup

And append configuration for GoVM to your setting file. If you use linux, append to .bashrc, .zshrc or etc:

export GOVM_ROOT=$HOME/.govm
export PATH=$GOVM_ROOT/versions/current/bin:$PATH

Or, if you use windows, add %USERPROFILE%\.govm as environment variable GOVM_ROOT and %GOVM_ROOT%/versions/current/bin as PATH.

Install Go with using GoVM

Installing Go requires some tools. See also http://golang.org/doc/install.

You had installed this tools, and run GoVM to install Go:

$ govm install go1.3

TOPIC: go1.3 is currently latest version of Go. If you feel this version is older, you can replace it.

Finish the command, you select to use the version of Go:

$ govm use go1.3

test of installed:

$ go version
go version go1.3 ...

Ok install!

And install other version Go

You want to use go1.2.1 (go1.2.1 is currently version of GAE SDK's Go). Run to install:

$ govm install go1.2.1

And select to use go1.2.1,

$ govm use go1.2.1
$ go version
go version go1.2.1 ...

If you need to use go1.3 again, select to use too:

$ govm use go1.3
$ go version
go version go1.3

Wonderful! Now, you got the version go1.2.1 and go1.3 and you can select to use version of Go freely.

How change the version of Go according to directory like .ruby-version with rbenv?

GoVM dosen't support and aren't going to support a such function. You should use direnv. direnv is usuful!

Thank you for reading!

1 Response
Add your response

To be fair the conflict is trivial to avoid... link to a binary thats named something else.

over 1 year ago ·