Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manage Environment Variables

I've previously used Python tools like virtualenv and virtualenvwrapper in Python projects, but now I'm working on a project in Go so I'd like a general tool to switch environment variables when I do something like

workon myproject
....
deactivate myproject

I especially like the workflow of virtualenv-wrapper with pre and post activation scripts in which I can preactivate.sh

export MYVAR=xxx 

and postactivate

unset MYVAR

The tools I've mentioned seem to be centered around Python and pip, but since my project is in Go, I don't know if its kosher for me to use Python tools that happen to provide environment variable management features. Anything more general purpose you would suggest and is not hard to set up?

This question is not necessarily Go lang specific.

like image 962
fractalous Avatar asked May 30 '26 08:05

fractalous


1 Answers

Yup, you can use gvm:

https://github.com/moovweb/gvm

If you've ever used rvm for ruby, it's similar to that.

like image 106
noj Avatar answered Jun 01 '26 22:06

noj