|
|
|
@ -1,22 +1,33 @@
|
|
|
|
|
#!/bin/sh
|
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
cd "$(mktemp -d)"
|
|
|
|
|
install_17() {
|
|
|
|
|
cd "$(mktemp -d)"
|
|
|
|
|
|
|
|
|
|
# TODO eventually update this to detect
|
|
|
|
|
os=mac
|
|
|
|
|
arch=amd64
|
|
|
|
|
os=linux
|
|
|
|
|
arch=amd64
|
|
|
|
|
|
|
|
|
|
file=$(curl -sSL "https://golang.org/dl/?mode=json" \
|
|
|
|
|
| jq -r '.[0].files[]
|
|
|
|
|
| select(.os == "'"$os"'")
|
|
|
|
|
| select(.arch == "'"$arch"'")
|
|
|
|
|
| .filename')
|
|
|
|
|
file=$(curl -sSL "https://golang.org/dl/?mode=json" \
|
|
|
|
|
| jq -r '.[0].files[]
|
|
|
|
|
| select(.os == "'"$os"'")
|
|
|
|
|
| select(.arch == "'"$arch"'")
|
|
|
|
|
| .filename')
|
|
|
|
|
|
|
|
|
|
curl -sSLO \
|
|
|
|
|
-H "Accept: application/vnd.github.v3+json" \
|
|
|
|
|
"https://dl.google.com/go/$file"
|
|
|
|
|
curl -sSLO \
|
|
|
|
|
-H "Accept: application/vnd.github.v3+json" \
|
|
|
|
|
"https://dl.google.com/go/$file"
|
|
|
|
|
|
|
|
|
|
sudo tar xzf "$file" -C /usr/local/
|
|
|
|
|
sudo tar xzf "$file" -C /usr/local/
|
|
|
|
|
|
|
|
|
|
echo "Make sure /usr/local/go/bin is in PATH"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
upgrade_18() {
|
|
|
|
|
/usr/local/go/bin/go install golang.org/dl/go1.18beta2@latest
|
|
|
|
|
"$GOBIN/go1.18beta2" download
|
|
|
|
|
go install golang.org/x/tools/gopls@latest
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#install_17
|
|
|
|
|
upgrade_18
|
|
|
|
|
|
|
|
|
|
echo "Make sure /usr/local/go/bin is in PATH"
|
|
|
|
|