diff --git a/README.md b/README.md index a994f8e..7ec4faa 100644 --- a/README.md +++ b/README.md @@ -82,12 +82,18 @@ To install the previous minor release of Go: gimme oldstable ``` -To install the most recent patch of the release specified in the `go.mod` file: +To install the release specified in the `go.mod` file: ``` bash gimme module ``` +If the `go` directive in the go.mod is in the form `go 1.21`, +`gimme module` will install the latest patch version, e.g. `1.21.5`. +However, if the `go` directive in go.mod is in the form `go 1.21.3`, +`gimme module` will install the exact version, `1.21.3`. +Note that the latter form is supported only by Go 1.21 or later. + Or to install and use the development version (master branch) of Go: ``` bash diff --git a/gimme b/gimme index 6f33c50..ca75944 100755 --- a/gimme +++ b/gimme @@ -904,13 +904,26 @@ 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 ;; arm64) - if [[ "${GIMME_GO_VERSION}" != master && "$(_versint "${GIMME_GO_VERSION}")" < "$(_versint 1.5)" ]]; then + min_arm64_version=1.5 + if [[ "${GIMME_HOSTOS}" == 'darwin' ]]; then + min_arm64_version=1.16 + fi + + if [[ "${GIMME_GO_VERSION}" != master && "$(_versint "${GIMME_GO_VERSION}")" < "$(_versint "$min_arm64_version")" ]]; then echo >&2 "error: ${GIMME_ARCH} is not supported by this go version" - echo >&2 "try go1.5 or newer" + echo >&2 "try go${min_arm64_version} or newer" exit 1 fi if [[ "${GIMME_HOSTOS}" == "linux" && "${GIMME_HOSTARCH}" != "${GIMME_ARCH}" ]]; then @@ -927,14 +940,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