Skip to content

Commit

Permalink
support .0 releases starting with 1.21.0
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAbides committed Aug 3, 2023
1 parent 8af5eb4 commit 6b49f7f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib.pl
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ sub go_version_string {
my $major_v = $$v{"major"};
my $minor_v = $$v{"minor"};
my $patch_v = $$v{"patch"};

# For 1.21 and above with no pre-release, always return major.minor.patch
if ( $major_v > 1 || ( $major_v == 1 && $minor_v >= 21 ) ) {
if ( $$v{"pre_release"} eq "" ) {
return "$major_v.$minor_v.$patch_v";
}
}

$patch_v = "" if $patch_v == 0;
$minor_v = "" if $minor_v == 0 && $patch_v eq "";
my $st = "$$v{'major'}";
Expand Down
3 changes: 3 additions & 0 deletions src/lib_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ test_select_go_version() {
do_test_select_go_version "" "x" "1.14beta1"
do_test_select_go_version "0" "x" "0"
do_test_select_go_version "" "1.2.3"
do_test_select_go_version "1.21.0" "1.21.x" "1.21.0"
do_test_select_go_version "1.21.0" "1.21" "1.21.0"
do_test_select_go_version "1.20" "1.20.x" "1.20.0"
}

test_select_remote_version() {
Expand Down

0 comments on commit 6b49f7f

Please sign in to comment.