Skip to content

Instantly share code, notes, and snippets.

@stefanprodan
Last active March 24, 2019 05:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stefanprodan/b0da05d7afc1d0f97a4c to your computer and use it in GitHub Desktop.
Save stefanprodan/b0da05d7afc1d0f97a4c to your computer and use it in GitHub Desktop.
setup golang dev env for ubuntu desktop
#!/bin/bash
GVERSION="1.4.2"
GFILE="go$GVERSION.linux-amd64.tar.gz"
LVERSION="27.2.1"
LFILE="liteidex$LVERSION.linux-64-qt4.tar.bz2"
GOPATH="$HOME/go"
if [ -d "$HOME/.go" ]; then
echo "Installation directories already exist $HOME/.go $HOME/go"
exit 1
fi
wget https://storage.googleapis.com/golang/$GFILE -O $TMPDIR/$GFILE
if [ $? -ne 0 ]; then
echo "Go download failed! Exiting."
exit 1
fi
wget http://sourceforge.net/projects/liteide/files/X$LVERSION/$LFILE -O $TMPDIR/$LFILE
if [ $? -ne 0 ]; then
echo "LiteIDE X download failed! Exiting."
exit 1
fi
tar -C "$HOME" -xzf $TMPDIR/$GFILE
mv "$HOME/go" "$HOME/.go"
touch "$HOME/.profile"
{
echo '# GoLang'
echo 'export GOROOT=$HOME/.go'
echo 'export PATH=$PATH:$GOROOT/bin'
echo 'export GOPATH=$HOME/go'
echo 'export PATH=$PATH:$GOPATH/bin'
} >> "$HOME/.profile"
source "$HOME/.profile"
echo "GOROOT set to $HOME/.go"
mkdir -p "$GOPATH" "$GOPATH/src" "$GOPATH/pkg" "$GOPATH/bin" "$GOPATH/out"
chmod 777 "$GOPATH" "$GOPATH/src" "$GOPATH/pkg" "$GOPATH/bin" "$GOPATH/out"
echo "GOPATH set to $GOPATH"
tar -C "$HOME" -xjf $TMPDIR/$LFILE
echo "LiteIDE X installed in $HOME/liteide"
echo "re-login to apply Go environment variables"
rm -f $TMPDIR/$GFILE
rm -f $TMPDIR/$LFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment