vulsctl
vulsctl copied to clipboard
Go environment variables should be defined only if Go is not already installed
Go env variables should be set only if go doesn't already exists in the system.
https://github.com/vulsio/vulsctl/blob/c9c08453728c9487198eec5006f55a50f02b4d48/install-host/install.sh#L9-L17
In my case for example, I already installed go and defined $GOPATH
variable. So install.sh
will define another $GOPATH
, and install new go modules there.
If you agree, I can do a quick pull request to fix this.
PS : Thank you for this wonderful tool
@sidahmed-malaoui, I think you are right but I've spotted another issue that I need to discuss with @kotakanbe, the following lines are wrong as the file .profile
is not loaded but the file .bash_profile
instead:
echo "export GOROOT=/usr/local/go" >> "$HOME"/.profile;
echo "export GOPATH=$HOME/go" >> "$HOME"/.profile;
echo "export PATH=$PATH:$GOROOT/bin:$GOPATH/bin" >> "$HOME"/.profile;
and should be replaced by:
echo "export GOROOT=/usr/local/go" >> $HOME/.bash_profile
echo "export GOPATH=$HOME/go" >> $HOME/.bash_profile
echo "export PATH=$PATH:$GOROOT/bin:$GOPATH/bin" >> $HOME/.bash_profile
Another thing that should be cleaned in the script is the leading ;
at the end of the lines, it is useless in bash
for running a single command.
@kotakanbe, here is the patching code I'm currently testing for the install-host/upgrade.sh
script:
# Dirty GO missing variables patch
if [[ -f $HOME/.profile ]]; then
source $HOME/.profile
else
source $HOME/.bash_profile
fi
Let me know what you prefer and I can do the required changes.
I agree with this issue.
In my case, on CentOS, I installed golang via yum and they placed go at /usr/lib/golang/bin
.
However, as it has mentioned in this issue, the script changes GOROOT
, then make install
in later part can't find the directory /usr/local/go
.
I solved simply just comment out line 9-11.