virtualenv golang

1,814 views
Skip to first unread message

Alexandru Plugaru

unread,
Nov 2, 2011, 4:25:57 AM11/2/11
to golan...@googlegroups.com
Hi,

I was wondering if there is a package for golang like python's virtualenv or ruby's rvm. The idea is to have different golang deployments (different packages/versions) on the same machine.

Cheers,
Alex.

Jim Whitehead II

unread,
Nov 2, 2011, 4:42:02 AM11/2/11
to golan...@googlegroups.com

There's nothing to stop you from doing this today, everything is self
contained and simple environmental variables keep things in check. You
can have multiple GOROOT directories, and as long as it and your PATH
are set properly it can be pretty easy to switch between them. You
might even have a shell script in each GOROOT that sets the
environment variables properly for you to work on that virtualenv,
say:

- Jim

Alexandru Plugaru

unread,
Nov 2, 2011, 5:26:51 AM11/2/11
to golan...@googlegroups.com
Thank you Jim,

I thought of that myself, but this means that for every environment I have to make a copy/build a new golang which takes time. Virtualenv doesn't need a separate installation, but creates an environment on top of the existing standard library/language version which is cheap to do.

Jim Whitehead II

unread,
Nov 2, 2011, 5:30:12 AM11/2/11
to golan...@googlegroups.com

Ah, sorry about that! For Go that would involve keeping separate
copies of bin and pkg (I think that's it), and there's nothing
built-in that supports anything like that, that I am aware of.

- Jim

Dave Cheney

unread,
Nov 2, 2011, 5:33:45 AM11/2/11
to Jim Whitehead II, golan...@googlegroups.com
If you want to switch the packages you are compiling against, not your
underlying go distribution I believe you can use $GOPATH for that.
$GOPATH is documented as part of goinstall --
http://golang.org/cmd/goinstall/

Hope that helps.

Cheers

Dave

Alexandru Plugaru

unread,
Nov 3, 2011, 9:31:41 AM11/3/11
to golan...@googlegroups.com
I found this golang dev setup: https://plus.google.com/113906371240881159155/posts/fTm8fuvmakB

I think it's a good way to keap golang, third-party and dev stuff separate. Maybe this helps people who look for this kind of insulation.

Good luck,
Alex.

tech...@gmail.com

unread,
Apr 7, 2015, 1:03:58 AM4/7/15
to golan...@googlegroups.com, alexandr...@gmail.com
Reply all
Reply to author
Forward
0 new messages