moovweb / gvm

Go Version Manager
http://github.com/moovweb/gvm
MIT License
10.13k stars 526 forks source link

How to use Go, GVM from a sudo context? #322

Open mcandre opened 5 years ago

mcandre commented 5 years ago

Sometimes I need to run Go command line tools from a privileged environment. However, gvm is trickier to use with sudo. The best I've found so far is:

$ sudo -E bash
$ <go, gvm, or custom go tool here...>
$ exit
$

However, it would be more convenient to have a one-line syntax for this kind of command call. Any tips?

I tried sudo -E tonixxx clean boil and sudo -E bash -c 'tonixxx clean boil' but strangely they were not able to receive my full environment, so bash was not able to find my tonixxx binary like it can in a normal user shell. I am loading gvm from direnv, in case that matters.

hosembafer commented 3 years ago

Are there updates here? I have the same problem.

ffrmns commented 2 years ago

I don't know whether this can answer, can't sudo $(which gvm) handle this?

ahmadateya commented 2 years ago

Same problem, is there any intention to fix this?