~whereswaldon/gover

7a860c63ff180a0ae43d2a4ada8416f7ac477fd9 — Chris Waldon 1 year, 7 months ago bb76437
feat: support arm64 machines

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
1 files changed, 15 insertions(+), 1 deletions(-)

M gover
M gover => gover +15 -1
@@ 8,12 8,26 @@ current_os() {
    uname | tr '[:upper:]' '[:lower:]'
}

current_arch() {
    uname -m | tr '[:upper:]' '[:lower:]'
}

SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
TARGET_VERSION=${1:-latest}
PREFIX=${PREFIX:-$(dirname "$SCRIPT_DIR")}
mkdir -p "$PREFIX"/lib "$PREFIX"/bin
GOOS=$(current_os)
GOARCH=amd64 # TODO: find a portable way to determine this without go installed

GOARCH=$(current_arch)
if [ $GOARCH = "x86_64" ]; then
    GOARCH="amd64"
elif [ $GOARCH = "arm64" ]; then
    # Do nothing, this is supported.
    true;
else
    echo "Unsupported architecture: $GOARCH"
    exit 1
fi

major() {
    out=$(echo "$1" | cut -d. -f1)