From 530fda45a9b83d377f00ed0c70d90418b659d9e7 Mon Sep 17 00:00:00 2001 From: zijiren233 Date: Tue, 3 Sep 2024 01:03:47 +0800 Subject: [PATCH] fix: android check platform --- script/build.sh | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/script/build.sh b/script/build.sh index fa09b50..bafc9e0 100755 --- a/script/build.sh +++ b/script/build.sh @@ -546,16 +546,15 @@ function initDefaultCGODeps() { esac ;; "android") - if [[ "${GOHOSTOS}" == "windows" ]] && [[ "${GOHOSTARCH}" != "amd64" ]]; then - echo -e "${COLOR_LIGHT_RED}CGO is disabled for android/${goarch}${micro:+"/$micro"}.${COLOR_RESET}" - return 1 - elif [[ "${GOHOSTOS}" == "linux" ]] && [[ "${GOHOSTARCH}" != "amd64" ]]; then - echo -e "${COLOR_LIGHT_RED}CGO is disabled for android/${goarch}${micro:+"/$micro"}.${COLOR_RESET}" - return 1 - elif [[ "${GOHOSTOS}" != "darwin" ]]; then - echo -e "${COLOR_LIGHT_RED}CGO is disabled for android/${goarch}${micro:+"/$micro"}.${COLOR_RESET}" - return 1 - fi + case "${GOHOSTOS}" in + "windows" | "linux") + [[ "${GOHOSTARCH}" != "amd64" ]] && echo -e "${COLOR_LIGHT_RED}CGO is disabled for android/${goarch}${micro:+"/$micro"}.${COLOR_RESET}" && return 1 + ;; + "darwin") ;; + *) + echo -e "${COLOR_LIGHT_RED}CGO is disabled for android/${goarch}${micro:+"/$micro"}.${COLOR_RESET}" && return 1 + ;; + esac initAndroidNDK "${goarch}" "${micro}" ;; *)