Skip to content

Commit

Permalink
Merge pull request #272 from ChronosMasterOfAllTime/fix_shims_semver
Browse files Browse the repository at this point in the history
move latest patch code below once definition path is set by goenv local
  • Loading branch information
ChronosMasterOfAllTime authored Nov 11, 2022
2 parents 632a486 + 36782b6 commit ab5e09c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions plugins/go-build/bin/goenv-install
Original file line number Diff line number Diff line change
Expand Up @@ -136,21 +136,23 @@ if [[ ${DEFINITION} == "latest" ]]; then
DEFINITION=$LATEST
# If unstable is supplied, install the latest available (including beta/rc) version
elif [[ ${DEFINITION} == "unstable" ]]; then
LATEST=$(latest_includes_unstable_version "[0-9]\\.[0-9]+")
echo "Installing latest (including unstable) version ${LATEST}..."
DEFINITION=$LATEST
LATEST_UNSTABLE=$(latest_includes_unstable_version "[0-9]\\.[0-9]+")
echo "Installing latest (including unstable) version ${LATEST_UNSTABLE}..."
DEFINITION=$LATEST_UNSTABLE
fi

[ -n "$DEFINITION" ] || DEFINITION="$(goenv-local 2>/dev/null || true)"
[ -n "$DEFINITION" ] || usage 1 >&2

# The latest patch version will be located, e.g if 1.11 is supplied they'll be changed to `1.11.x`.
# NOTE: Try to capture semantic versions such as `1.11` which don't have a patch version and install latest patch.
elif grep -q -E "^[0-9]+\.[0-9]+(\s*)$" <<<${DEFINITION}; then
if grep -q -E "^[0-9]+\.[0-9]+(\s*)$" <<<${DEFINITION}; then
REGEX=$(echo $DEFINITION | sed s/\\./\\\\./)
LATEST_PATCH=$(latest_version $REGEX)
echo "Using latest patch version $LATEST_PATCH"
DEFINITION="$LATEST_PATCH"
DEFINITION=$LATEST_PATCH
fi

[ -n "$DEFINITION" ] || DEFINITION="$(goenv-local 2>/dev/null || true)"
[ -n "$DEFINITION" ] || usage 1 >&2

# Define `before_install` and `after_install` functions that allow
# plugin hooks to register a string of code for execution before or
# after the installation process.
Expand Down

0 comments on commit ab5e09c

Please sign in to comment.