Skip to content

Commit

Permalink
[GH-54] Fix golang releases without patch version 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 fa2487d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ Change line format:

## Unreleased (master)

### Fixed

* Golang releases without patch version not being installed ; Ref: https://github.com/syndbg/goenv/pull/75

## 2.0.0beta8

### Added
Expand Down
6 changes: 6 additions & 0 deletions plugins/go-build/bin/go-build
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,12 @@ 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 added, 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 fa2487d

Please sign in to comment.