Skip to content

Instantly share code, notes, and snippets.

@NSK-1010
Last active April 15, 2024 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NSK-1010/691813e6ed452b7362e264816a6437b7 to your computer and use it in GitHub Desktop.
Save NSK-1010/691813e6ed452b7362e264816a6437b7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -x
wget https://go.dev/dl/go1.22.2.linux-amd64.tar.gz -O /tmp/go.tar.gz
dpkg -s golang > /dev/null 2>&1
if [ $? -eq 0 ]; then
apt-get purge -y golang
apt-get autoremove -y
fi
dpkg -s golang-go > /dev/null 2>&1
if [ $? -eq 0 ]; then
apt-get purge -y golang-go
apt-get autoremove -y
fi
if [ -d /usr/local/go ]; then
rm -rf /usr/local/go
fi
homedir=$(getent passwd ${SUDO_USER:-$USER} | cut -d: -f6)
if [ -d $homedir/.local/go ]; then
rm -rf $homedir/.local/go
fi
tar -C /usr/local -xzf /tmp/go.tar.gz
rm /tmp/go.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.profile
wget https://vscode.download.prss.microsoft.com/dbazure/download/stable/e170252f762678dec6ca2cc69aba1570769a5d39/code_1.88.1-1712771838_amd64.deb -O /tmp/code.deb
chmod 777 /tmp/code.deb
apt-get install --no-install-recommends -y /tmp/code.deb
rm /tmp/code.deb
set +x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment