fix: correct go.sh (#55)
This commit is contained in:
@@ -7,7 +7,7 @@ set -Eeuxo pipefail
|
|||||||
|
|
||||||
printf "\n\t🐋 Installing Go(lang) 🐋\t\n"
|
printf "\n\t🐋 Installing Go(lang) 🐋\t\n"
|
||||||
|
|
||||||
JSON=$(wget -qO- "$(jq -r '.toolcache[] | select(.name == "go") | .url' "/imagegeneration/toolset.json")" | jq --compact-output)
|
wget -qO- "$(jq -r '.toolcache[] | select(.name == "go") | .url' "/imagegeneration/toolset.json")" > "/tmp/go-toolset.json"
|
||||||
|
|
||||||
go_arch() {
|
go_arch() {
|
||||||
case "$(uname -m)" in
|
case "$(uname -m)" in
|
||||||
@@ -18,11 +18,18 @@ go_arch() {
|
|||||||
|
|
||||||
for V in $(jq -r '.toolcache[] | select(.name == "go") | .versions[]' "/imagegeneration/toolset.json"); do
|
for V in $(jq -r '.toolcache[] | select(.name == "go") | .versions[]' "/imagegeneration/toolset.json"); do
|
||||||
printf "\n\t🐋 Installing GO=%s 🐋\t\n" "${V}"
|
printf "\n\t🐋 Installing GO=%s 🐋\t\n" "${V}"
|
||||||
VER=$(echo "${JSON}" | jq "[.[] | select(.version|test(\"^${V}\"))][0].version" -r)
|
VER=$(jq -r "[.[] | select(.version|test(\"^${V}\"))][0].version" "/tmp/go-toolset.json")
|
||||||
GOPATH="$AGENT_TOOLSDIRECTORY/go/${VER}/x64"
|
GOPATH="$AGENT_TOOLSDIRECTORY/go/${VER}/x64"
|
||||||
|
|
||||||
mkdir -v -m 0777 -p "$GOPATH"
|
mkdir -v -m 0777 -p "$GOPATH"
|
||||||
wget -qO- "https://golang.org/dl/go${VER}.linux-$(go_arch).tar.gz" | tar -zxf - --strip-components=1 -C "$GOPATH"
|
DL_VER="${VER}"
|
||||||
|
# hack
|
||||||
|
# TODO: i hate shell scripts, please can I have powershell on linux and no, python is not a solution, it should die
|
||||||
|
# TODO: write own thing to get links from go.dev and versions from actions/go-versions, mash it together, ?????, works
|
||||||
|
if [[ "$(echo ${VER} | cut -d. -f3)" == "0" ]]; then
|
||||||
|
DL_VER=$(echo "${VER}" | cut -d. -f-2)
|
||||||
|
fi
|
||||||
|
wget -qO- "https://golang.org/dl/go${DL_VER}.linux-$(go_arch).tar.gz" | tar -zxf - --strip-components=1 -C "$GOPATH"
|
||||||
|
|
||||||
# ENVVAR="${V//\./_}"
|
# ENVVAR="${V//\./_}"
|
||||||
# echo "${ENVVAR}=${GOPATH}" >>/etc/environment
|
# echo "${ENVVAR}=${GOPATH}" >>/etc/environment
|
||||||
@@ -30,7 +37,7 @@ for V in $(jq -r '.toolcache[] | select(.name == "go") | .versions[]' "/imagegen
|
|||||||
printf "\n\t🐋 Installed GO 🐋\t\n"
|
printf "\n\t🐋 Installed GO 🐋\t\n"
|
||||||
"$GOPATH/bin/go" version
|
"$GOPATH/bin/go" version
|
||||||
|
|
||||||
if [[ "${V}" == "1.15" ]]; then
|
if [[ "${V}" == "1.15.*" ]]; then
|
||||||
ln -s "$GOPATH/bin/*" /usr/bin/
|
ln -s "$GOPATH/bin/*" /usr/bin/
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user