From 50d5776308b56fa5f59ecb42faf3ab9ce4bb8368 Mon Sep 17 00:00:00 2001 From: Joel Cooklin Date: Wed, 1 Feb 2017 18:00:57 -0800 Subject: [PATCH] Improves portability of GOOS and GOARCH - GOOS and GOARCH can be effectively detected by 'go env' - Supports MinGW --- scripts/build_plugins.sh | 6 +++--- scripts/build_snap.sh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/build_plugins.sh b/scripts/build_plugins.sh index fed44c801..d6411845b 100755 --- a/scripts/build_plugins.sh +++ b/scripts/build_plugins.sh @@ -38,8 +38,8 @@ _info "git commit: $(git log --pretty=format:"%H" -1)" export CGO_ENABLED=0 # rebuild binaries: -export GOOS=${GOOS:-$(uname -s | tr '[:upper:]' '[:lower:]')} -export GOARCH=${GOARCH:-"amd64"} +export GOOS=${GOOS:-$(go env GOOS)} +export GOARCH=${GOARCH:-$(go env GOARCH)} OS=$(uname -s) if [[ "${OS}" == "Darwin" ]]; then @@ -58,5 +58,5 @@ else fi mkdir -p "${build_path}/plugins" -_info "building plugins for ${GOOS}/${GOARCH} in ${p} parallels" +_info "building plugins for ${GOOS}/${GOARCH} in ${p} parallel processes" find "${__proj_dir}/plugin/" -type d -iname "snap-*" -print0 | xargs -0 -n 1 -P $p -I{} "${__dir}/build_plugin.sh" {} diff --git a/scripts/build_snap.sh b/scripts/build_snap.sh index e5aa002b3..ac0297862 100755 --- a/scripts/build_snap.sh +++ b/scripts/build_snap.sh @@ -39,8 +39,8 @@ _info "git commit: $(git log --pretty=format:"%H" -1)" export CGO_ENABLED=0 # rebuild binaries: -export GOOS=${GOOS:-$(uname -s | tr '[:upper:]' '[:lower:]')} -export GOARCH=${GOARCH:-"amd64"} +export GOOS=${GOOS:-$(go env GOOS)} +export GOARCH=${GOARCH:-$(go env GOARCH)} if [[ "${GOARCH}" == "amd64" ]]; then build_path="${__proj_dir}/build/${GOOS}/x86_64"