To understand my problem, here's my current setup:
I'm working with a user "foo", that user has a $GOPATH
as /foo/go/
.
This user is in the sudo'ers group.
I am trying to work in a git directory on a go project. If I use sudo I can edit the file, the problem is that if I try to build my project from vim, or run anything from my gopath (such as :GoMetaLinter
) then it runs in the context of the root user, since I used sudo, but this user has no gopath set.
I don't really understand how to solve this properly. I've restored to opening the file as read only to use my linter and then using vim to sudo and write, but that's stupid, and I know it's not "correct". What is the proper way for using sudo so my local users context/variables are used and not roots?
sudo -E
?