diff --git a/setup-go.sh b/setup-go.sh index 4c2d796..b0d0b3e 100755 --- a/setup-go.sh +++ b/setup-go.sh @@ -7,20 +7,9 @@ GO_LINUX_PACKAGE_URL="https://go.dev/dl/$(curl https://go.dev/VERSION?m=text | h if [[ "${INPUT_GOVERSION##*/}" == "go.mod" ]]; then INPUT_GOVERSION=$(grep -e '^go' -m 1 ${INPUT_GOVERSION} | sed -e 's/go //g') fi -if [[ ${INPUT_GOVERSION} == "1.19" ]]; then - GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.19.1.linux-${ARCH}.tar.gz" -elif [[ ${INPUT_GOVERSION} == "1.18" ]]; then - GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.18.6.linux-${ARCH}.tar.gz" -elif [[ ${INPUT_GOVERSION} == "1.17" ]]; then - GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.17.13.linux-${ARCH}.tar.gz" -elif [[ ${INPUT_GOVERSION} == "1.16" ]]; then - GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.16.15.linux-${ARCH}.tar.gz" -elif [[ ${INPUT_GOVERSION} == "1.15" ]]; then - GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.15.15.linux-${ARCH}.tar.gz" -elif [[ ${INPUT_GOVERSION} == "1.14" ]]; then - GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.14.15.linux-${ARCH}.tar.gz" -elif [[ ${INPUT_GOVERSION} == "1.13" ]]; then - GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.13.15.linux-${ARCH}.tar.gz" +if [[ ${INPUT_GOVERSION} =~ "^1\.[0-9]+" ]]; then + LATEST_MINOR_GOVERSION=$(curl -s https://go.dev/dl/ | grep -oP "go${INPUT_GOVERSION}\.\d+" | head -n 1 | cut -c 3-) + GO_LINUX_PACKAGE_URL="https://go.dev/dl/go${LATEST_MINOR_GOVERSION}.linux-${ARCH}.tar.gz" elif [[ ${INPUT_GOVERSION} == http* ]]; then GO_LINUX_PACKAGE_URL=${INPUT_GOVERSION} elif [[ -n ${INPUT_GOVERSION} ]]; then