Skip to content

Commit 75940b0

Browse files
Merge pull request #24 from abhinav/resolve-before-arch
fix: Resolve version before checking arch
2 parents 975cf32 + 94d20cb commit 75940b0

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,18 @@ To install the previous minor release of Go:
8282
gimme oldstable
8383
```
8484

85-
To install the most recent patch of the release specified in the `go.mod` file:
85+
To install the release specified in the `go.mod` file:
8686

8787
``` bash
8888
gimme module
8989
```
9090

91+
If the `go` directive in the go.mod is in the form `go 1.21`,
92+
`gimme module` will install the latest patch version, e.g. `1.21.5`.
93+
However, if the `go` directive in go.mod is in the form `go 1.21.3`,
94+
`gimme module` will install the exact version, `1.21.3`.
95+
Note that the latter form is supported only by Go 1.21 or later.
96+
9197
Or to install and use the development version (master branch) of Go:
9298

9399
``` bash

gimme

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -904,13 +904,26 @@ if [[ -n "${2}" ]]; then
904904
GIMME_VERSION_PREFIX="${2}"
905905
fi
906906

907+
case "${GIMME_GO_VERSION}" in
908+
stable) GIMME_GO_VERSION=$(_get_curr_stable) ;;
909+
oldstable) GIMME_GO_VERSION=$(_get_old_stable) ;;
910+
module) GIMME_GO_VERSION=$(_resolve_version module) ;;
911+
esac
912+
913+
_assert_version_given "$@"
914+
907915
case "${GIMME_ARCH}" in
908916
x86_64) GIMME_ARCH=amd64 ;;
909917
x86) GIMME_ARCH=386 ;;
910918
arm64)
911-
if [[ "${GIMME_GO_VERSION}" != master && "$(_versint "${GIMME_GO_VERSION}")" < "$(_versint 1.5)" ]]; then
919+
min_arm64_version=1.5
920+
if [[ "${GIMME_HOSTOS}" == 'darwin' ]]; then
921+
min_arm64_version=1.16
922+
fi
923+
924+
if [[ "${GIMME_GO_VERSION}" != master && "$(_versint "${GIMME_GO_VERSION}")" < "$(_versint "$min_arm64_version")" ]]; then
912925
echo >&2 "error: ${GIMME_ARCH} is not supported by this go version"
913-
echo >&2 "try go1.5 or newer"
926+
echo >&2 "try go${min_arm64_version} or newer"
914927
exit 1
915928
fi
916929
if [[ "${GIMME_HOSTOS}" == "linux" && "${GIMME_HOSTARCH}" != "${GIMME_ARCH}" ]]; then
@@ -927,14 +940,6 @@ arm64) ;;
927940
arm*) GIMME_HOSTARCH=arm ;;
928941
esac
929942

930-
case "${GIMME_GO_VERSION}" in
931-
stable) GIMME_GO_VERSION=$(_get_curr_stable) ;;
932-
oldstable) GIMME_GO_VERSION=$(_get_old_stable) ;;
933-
module) GIMME_GO_VERSION=$(_resolve_version module) ;;
934-
esac
935-
936-
_assert_version_given "$@"
937-
938943
((force_install)) && _wipe_version "${GIMME_GO_VERSION}"
939944

940945
unset GOARCH

0 commit comments

Comments
 (0)