Skip to content

Commit

Permalink
[GH-54] Fix golang releases without patch not being installed
Browse files Browse the repository at this point in the history
This workarounds two sides' choices.

First Golang does not release major versions,
 e.g `1.11.0` with the patch version of `0`.

Second goenv only adds installable definitions
 with patch version as per semantic versioning by the book (arguably).

The solution here is when provided with a install definition such as `1.11`
 to add a patch version of `0` automatically and the result will be a search
 for install definition `1.11.0`.
  • Loading branch information
syndbg committed Apr 9, 2019
1 parent 55e3b74 commit 0b5e4a2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions plugins/go-build/bin/go-build
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,13 @@ done
[ "${#ARGUMENTS[@]}" -eq 2 ] || usage 1 >&2

DEFINITION_PATH="${ARGUMENTS[0]}"
# NOTE: Try to capture semantic versions such as `1.11` which don't have a patch version.
# A patch version of 0 will be adde, e.g they'll be changed to `1.11.0`.
if grep -q -E "^[0-9]+\.[0-9]+(\s*)$" <<< ${DEFINITION_PATH}; then
DEFINITION_PATH="${DEFINITION_PATH}.0"
fi


if [ -z "$DEFINITION_PATH" ]; then
usage 1 >&2
elif [ ! -f "$DEFINITION_PATH" ]; then
Expand Down

0 comments on commit 0b5e4a2

Please sign in to comment.