Skip to content

Commit

Permalink
fix: Resolve version before checking arch
Browse files Browse the repository at this point in the history
Fixes a bug where `gimme module` reports the following error
on macOS with ARM64.

    error: arm64 is not supported by this go version
    try go1.5 or newer

This occurs because the check for architecture
is performed before the `module` version
turns into a real version number with `_resolve_version`.

Fix by resolving version number before checking the architecture.
  • Loading branch information
abhinav committed Feb 3, 2024
1 parent 975cf32 commit 10f140b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions gimme
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,14 @@ if [[ -n "${2}" ]]; then
GIMME_VERSION_PREFIX="${2}"
fi

case "${GIMME_GO_VERSION}" in
stable) GIMME_GO_VERSION=$(_get_curr_stable) ;;
oldstable) GIMME_GO_VERSION=$(_get_old_stable) ;;
module) GIMME_GO_VERSION=$(_resolve_version module) ;;
esac

_assert_version_given "$@"

case "${GIMME_ARCH}" in
x86_64) GIMME_ARCH=amd64 ;;
x86) GIMME_ARCH=386 ;;
Expand All @@ -927,14 +935,6 @@ arm64) ;;
arm*) GIMME_HOSTARCH=arm ;;
esac

case "${GIMME_GO_VERSION}" in
stable) GIMME_GO_VERSION=$(_get_curr_stable) ;;
oldstable) GIMME_GO_VERSION=$(_get_old_stable) ;;
module) GIMME_GO_VERSION=$(_resolve_version module) ;;
esac

_assert_version_given "$@"

((force_install)) && _wipe_version "${GIMME_GO_VERSION}"

unset GOARCH
Expand Down

0 comments on commit 10f140b

Please sign in to comment.