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.
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: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
andsudo -E bash -c 'tonixxx clean boil'
but strangely they were not able to receive my full environment, so bash was not able to find mytonixxx
binary like it can in a normal user shell. I am loading gvm from direnv, in case that matters.