Skip to content

Commit

Permalink
1.21 is not a precise version
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAbides committed Aug 8, 2023
1 parent beea216 commit a6863d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib
Expand Up @@ -114,8 +114,9 @@ exe_name() {
}

is_precise_version() {
[[ $1 =~ ^[0-9]+(.[0-9]+(.[0-9]+)?)?([A-Za-z0-9]+)?$ ]] && return
return 1
[[ $1 =~ ^[0-9]+(.([0-9]+)(.[0-9]+)?)?([A-Za-z0-9]+)?$ ]] || return 1
# false when minor is >= 21 and patch is empty
[ -z "${BASH_REMATCH[2]}" ] || [ "${BASH_REMATCH[2]}" -lt 21 ] || [ -n "${BASH_REMATCH[3]}" ]
}

select_go_version() {
Expand Down
3 changes: 3 additions & 0 deletions src/lib_test.sh
Expand Up @@ -40,6 +40,8 @@ test_is_precise_version() {
9999.9999.9999
1.15beta1
1.16rc1
1.21.0
1.21.1
'

for v in $versions; do
Expand All @@ -48,6 +50,7 @@ test_is_precise_version() {
done

not_versions='
1.21
*
1.x
1.15.x
Expand Down

0 comments on commit a6863d5

Please sign in to comment.