Skip to content

Instantly share code, notes, and snippets.

@dereknex
Last active March 16, 2022 02:13
Show Gist options
  • Select an option

  • Save dereknex/447b3cc5cdddf6981ea0e5a429209238 to your computer and use it in GitHub Desktop.

Select an option

Save dereknex/447b3cc5cdddf6981ea0e5a429209238 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -euo pipefail
case $(uname -m) in
aarch64) ARCH=arm64;;
armv7l) ARCH=arm;;
*) ARCH=$(uname -m);;
esac
echo 'Please input golang version:'
read VER
echo 'Remove old go files.'
sudo rm -rf /usr/local/go
curl -sL https://dl.google.com/go/go${VER}.linux-${ARCH}.tar.gz -o /tmp/go.tar.gz
sudo tar -xzf /tmp/go.tar.gz -C /usr/local/
rm /tmp/go.tar.gz
echo 'All done!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment