Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore prelease part of go version #245

Merged
merged 2 commits into from Feb 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 10 additions & 5 deletions mlocal/scripts/check-min-go-version
Expand Up @@ -17,6 +17,11 @@ if [ "$GOMINOR" = "$GOPATCH" ]; then
else
GOMINOR="${GOMINOR/.*}"
fi
# ignore GO pre-release extensions
if ! [[ "$GOMINOR" =~ ^[0-9]$ ]]; then
# shellcheck disable=SC2001
GOMINOR="$(echo "$GOMINOR"|sed 's/^\([0-9]*\).*/\1/')"
fi

MINVERSION="$2"
MINMAJOR="${MINVERSION/.*}"
Expand All @@ -28,16 +33,16 @@ else
MINMINOR="${MINMINOR/.*}"
fi

if [ $GOMAJOR -lt $MINMAJOR ]; then
if [ "$GOMAJOR" -lt "$MINMAJOR" ]; then
exit 1
fi
if [ $GOMAJOR -gt $MINMAJOR ]; then
if [ "$GOMAJOR" -gt "$MINMAJOR" ]; then
exit 0
fi
if [ $GOMINOR -lt $MINMINOR ]; then
if [ "$GOMINOR" -lt "$MINMINOR" ]; then
exit 1
fi
if [ $GOMINOR -gt $MINMINOR ]; then
if [ "$GOMINOR" -gt "$MINMINOR" ]; then
exit 0
fi
if [ -z "$MINPATCH" ]; then
Expand All @@ -46,7 +51,7 @@ fi
if [ -z "$GOPATCH" ]; then
exit 1
fi
if [ $GOPATCH -lt $MINPATCH ]; then
if [ "$GOPATCH" -lt "$MINPATCH" ]; then
exit 1
fi
exit 0