-
-
Save pivaldi/f153b36cf2c9bdeaacd37fbcf2d0a3ea to your computer and use it in GitHub Desktop.
Revisions
-
pivaldi revised this gist
Aug 25, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -34,7 +34,7 @@ $update && { curl -OL https://go.dev/dl/"$release_file" || exit 1 if type go &>/dev/null; then goroot=$(go env | grep GOROOT | cut -d'=' -f2 | tr -d "\"'") [ -z "$goroot" ] && { echo "Failed to retrieve last GOROOT env variable" exit 1 -
pivaldi revised this gist
Aug 12, 2025 . 1 changed file with 45 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ #!/usr/bin/bash set -e tmp=$(mktemp -d) @@ -10,25 +11,53 @@ function cleanup { } trap cleanup EXIT version=$(go version | cut -d' ' -f3) release=$(wget -qO- "https://golang.org/VERSION?m=text" | grep -E '^go[1-9]\.[0-9]+\.[0-9]+$') [ -z "$release" ] && { echo "Failed to retrieve last release" exit 1 } release_file="${release}.linux-amd64.tar.gz" update=true if [[ $version == "$release" ]]; then echo "Local Go version ${release} is the latest." update=false else echo "Local Go version ${version}, new release ${release} is available." fi $update && { echo "Downloading https://go.dev/dl/$release_file ..." curl -OL https://go.dev/dl/"$release_file" || exit 1 if type go &>/dev/null; then goroot=$(go env | grep GOROOT | cut -d'=' -f2 | tr -d '"') [ -z "$goroot" ] && { echo "Failed to retrieve last GOROOT env variable" exit 1 } [ -e "$goroot" ] && { echo "removing folder $goroot" sudo rm -irf "$goroot" } else goroot=/usr/local/go fi sudo tar -C "${goroot//go/}" -xzf "$release_file" version=$(go version | cut -d' ' -f3) echo "local Go version is $version (latest)" echo "installing latest Go Tools" go install golang.org/x/tools/cmd/goimports@latest go install golang.org/x/tools/gopls@latest } # Update binaries installed by "go install" with goroutines. go install github.com/nao1215/gup@latest gup update -
theaog revised this gist
Sep 1, 2023 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,12 +10,12 @@ function cleanup { } trap cleanup EXIT version=$(go version |cut -d' ' -f3) release=$(wget -qO- "https://golang.org/VERSION?m=text"| grep go) release_file="${release}.linux-amd64.tar.gz" if [[ $version == "$release" ]]; then echo "local Go version ${release} is the latest." exit 0 else echo "local Go version ${version}, new release ${release} is available." @@ -27,8 +27,8 @@ curl -OL https://go.dev/dl/"$release_file" goroot=$(go env |grep GOROOT |cut -d'=' -f2 |tr -d '"') echo "removing folder $goroot" sudo rm -rf "$goroot" sudo tar -C "${goroot//go}" -xzf "$release_file" version=$(go version |cut -d' ' -f3) echo "local Go version is $version (latest)" -
theaog created this gist
Jun 8, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ #!/usr/bin/env bash set -e tmp=$(mktemp -d) pushd "$tmp" || exit 1 function cleanup { popd || exit 1 rm -rf "$tmp" } trap cleanup EXIT version=$(go tool dist version) release=$(wget -qO- "https://golang.org/VERSION?m=text") release_file="${release}.linux-amd64.tar.gz" if [[ $version == "$release" ]]; then echo "local Go version ${release} is latest." exit 0 else echo "local Go version ${version}, new release ${release} is available." fi echo "Downloading https://go.dev/dl/$release_file ..." curl -OL https://go.dev/dl/"$release_file" goroot=$(go env |grep GOROOT |cut -d'=' -f2 |tr -d '"') echo "removing folder $goroot" sudo rm -f "$goroot" sudo tar -C "${goroot//go}" -xzf "$release_file" version=$(go tool dist version) echo "local Go version is $version (latest)"