Skip to content

Instantly share code, notes, and snippets.



Forked from Zate/
Created Jan 17, 2020
What would you like to do?
Shell script to download and install latest golang
#! /bin/bash
# [](
# Download latest Golang release for AMD64
set -euf -o pipefail
# Install pre-reqs
sudo apt-get install python3 git -y
o=$(python3 -c $'import os\nprint(os.get_blocking(0))\nos.set_blocking(0, True)')
#Download Latest Go
echo "Finding latest version of Go for AMD64..."
url="$(wget -qO- | grep -oP 'https:\/\/dl\.google\.com\/go\/go([0-9\.]+)\.linux-amd64\.tar\.gz' | head -n 1 )"
latest="$(echo $url | grep -oP 'go[0-9\.]+' | grep -oP '[0-9\.]+' | head -c -2 )"
echo "Downloading latest Go for AMD64: ${latest}"
wget --quiet --continue --show-progress "${url}"
unset url
# Remove Old Go
sudo rm -rf /usr/local/go
# Install new Go
sudo tar -C /usr/local -xzf go"${latest}".linux-amd64.tar.gz
echo "Create the skeleton for your local users go directory"
mkdir -p ~/go/{bin,pkg,src}
echo "Setting up GOPATH"
echo "export GOPATH=~/go" >> ~/.profile && source ~/.profile
echo "Setting PATH to include golang binaries"
echo "export PATH='$PATH':/usr/local/go/bin:$GOPATH/bin" >> ~/.profile && source ~/.profile
echo "Installing dep for dependency management"
go get -u
# Remove Download
rm go"${latest}".linux-amd64.tar.gz
# Print Go Version
/usr/local/go/bin/go version
python3 -c $'import os\nos.set_blocking(0, '$o')'
#! /bin/bash
set -euf -o pipefail
sudo apt-get install gpg -y
curl | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt-get update -y
sudo apt-get install code-insiders -y
sudo apt-get install libxss1 libasound2 -y
code-insiders --install-extension lukehoban.Go
code-insiders --install-extension PeterJausovec.vscode-docker
code-insiders --install-extension Zignd.html-css-class-completion
code-insiders --install-extension ecmel.vscode-html-css
code-insiders --install-extension redhat.vscode-yaml
code-insiders --install-extension codezombiech.gitignore
code-insiders --install-extension IBM.output-colorizer
code-insiders --install-extension donjayamanne.git-extension-pack
code-insiders --install-extension formulahendry.docker-extension-pack
code-insiders --install-extension
code-insiders --install-extension eamodio.gitlens
code-insiders --install-extension donjayamanne.githistory
code-insiders --install-extension Shan.code-settings-sync
code-insiders --install-extension Equinusocio.vsc-material-theme
code-insiders --install-extension yzhang.markdown-all-in-one
code-insiders --install-extension anseki.vscode-color
code-insiders --install-extension shd101wyy.markdown-preview-enhanced
code-insiders --install-extension PKief.material-icon-theme
code-insiders --install-extension robertohuertasm.vscode-icons
code-insiders --list-extensions --show-versions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment