Merge pull request 'Use Go 1.21, refactor Go setup function' (#41) from gmem/setup-forgejo:go-version-1.21 into main

Reviewed-on: https://code.forgejo.org/actions/setup-forgejo/pulls/41
Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
This commit is contained in:
dachary 2023-08-15 08:47:27 +00:00
commit 13b596c720

View file

@ -10,12 +10,14 @@ DIR=$(mktemp -d)
trap "rm -fr $DIR" EXIT trap "rm -fr $DIR" EXIT
function dependency_go() { function dependency_go() {
go_version="1.21.0.linux-amd64" # Set the desired Go version here
if ! which go > /dev/null ; then if ! which go > /dev/null ; then
apt-get update apt-get update
apt-get install -y -qq wget tar apt-get install -y -qq wget tar
wget --quiet https://go.dev/dl/go1.20.5.linux-amd64.tar.gz wget --quiet "https://go.dev/dl/go$go_version.tar.gz"
tar zxf go1.20.5.linux-amd64.tar.gz tar zxf "go$go_version.tar.gz"
export PATH=$PATH:$(pwd)/go/bin export PATH="$PATH:$(pwd)/go/bin"
fi fi
} }