Skip to content

Instantly share code, notes, and snippets.

@crgimenes
Forked from jniltinho/update-golang.sh
Last active November 16, 2023 12: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 crgimenes/733e498fa4e3556a0ac538e71ba2fbbe to your computer and use it in GitHub Desktop.
Save crgimenes/733e498fa4e3556a0ac538e71ba2fbbe to your computer and use it in GitHub Desktop.
update-golang.sh
#!/bin/bash
## Update Golang (Linux/Mac)
go version
## Get Last Stable Version
LAST_VERSION=$(curl -s 'https://go.dev/VERSION?m=text'|head -n1)
os="linux"
if [ "$(uname -s)" = "Darwin" ]; then
os="darwin"
fi
arch="amd64"
if [ "$(uname -m)" = "arm64" ]; then
arch="arm64"
fi
curl -sO --progress-bar "https://go.dev/dl/${LAST_VERSION}.$os-$arch.tar.gz"
rm -rf /usr/local/go
tar -C /usr/local -xzf go*.$os-$arch.tar.gz
rm -f go*.$os-$arch.tar.gz
go versionb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment