From 94b84099ed5ec13844cb17735ff821a5ec72bc90 Mon Sep 17 00:00:00 2001 From: Celian Raimbault Date: Mon, 2 Dec 2024 14:38:45 +0100 Subject: [PATCH] Allow unprefixed go versions --- scripts/env/cd | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/env/cd b/scripts/env/cd index ea1d1953..9c8a628c 100644 --- a/scripts/env/cd +++ b/scripts/env/cd @@ -181,7 +181,7 @@ __gvmp_find_closest_dot_go_pkgset() { __gvmp_read_dot_go_version() { local filepath="${1}" local version="" - local regex='^(go([0-9]+(\.[0-9]+)*))$' + local regex='^((go)?([0-9]+(\.[0-9]+)*))$' while IFS=$'\n' read -r _line; do # skip comment lines @@ -189,7 +189,12 @@ __gvmp_read_dot_go_version() { # looking for pattern "go1.2[.3]" if [[ "${_line}" =~ ${regex} ]]; then - version="${_line}" + if [[ "${_line}" = go* ]]; then + version="${_line}" + else + # if the version is not prefixed with "go" add it + version="go${_line}" + fi break fi done <<< "$(cat "${filepath}")"