Use go installed in ~/opt/go

This commit is contained in:
Anthony Rose 2020-10-07 21:21:59 +01:00
parent 8d4ddb9aee
commit 7d298ea310

View file

@ -188,12 +188,16 @@ fi
# Set up GOPATH.
export GOPATH="$HOME/data/go"
if [ -x /usr/bin/go ] || [ -x /usr/local/bin/go ]; then
if [ -x $HOME/opt/go/bin/go ] || [ -x /usr/bin/go ] || [ -x /usr/local/bin/go ]; then
if [ ! -d "$GOPATH" ]; then
mkdir -p "$GOPATH/bin"
mkdir -p "$GOPATH/pkg"
mkdir -p "$GOPATH/src"
fi
if [ -x $HOME/opt/go/bin/go ]; then
export GOROOT="$HOME/opt/go"
export PATH="$PATH:$GOROOT/bin"
fi
export PATH="$PATH:$GOPATH"
fi