From db9ab6a0e9dd05460f70eac8397c7aab7de8fe46 Mon Sep 17 00:00:00 2001 From: Aminda Suomalainen Date: Sun, 7 Jan 2024 09:16:30 +0200 Subject: [PATCH] bash/usr-local-bin/go: hardcode go version for Debian fallback TODO: FIXME: this version should be figured automatically, why is it just not available in update-alternatives? --- bash/usr-local-bin/go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/bash/usr-local-bin/go b/bash/usr-local-bin/go index 8459ad1..984ca3b 100755 --- a/bash/usr-local-bin/go +++ b/bash/usr-local-bin/go @@ -1,16 +1,24 @@ #!/usr/bin/env bash -# Using the snap version of go if available +# Using the snap version of go if available. Or wherever Debian hides newer +# Go set -x +# TODO: this should be automatic +export GOVERSION=1.21 + # Check if go is installed through snap if [ -f /snap/bin/go ]; then - snap run go $@ + snap run go "$@" -# Fallback to system installation +# Or if Debian hides it somewhere nice. +elif [ -f /usr/lib/go-$GOVERSION/bin/go ]; then + /usr/lib/go-$GOVERSION/bin/go "$@" + +# Fallback to system default version else - /usr/bin/go $@ + /usr/bin/go "$@" fi set +x