From d762db5424d5f38910e35f3e6e77453f13fe6482 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Thu, 19 Jul 2018 13:54:46 -0700 Subject: [PATCH] fix path sep on windows in check_go_path License: MIT Signed-off-by: Steven Allen --- bin/check_go_path | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bin/check_go_path b/bin/check_go_path index 4f8c0025faa6..f948d26f053e 100755 --- a/bin/check_go_path +++ b/bin/check_go_path @@ -7,10 +7,16 @@ PKG="$1" DIR="$(pwd -P)" GOPATH="$(go env GOPATH)" -while read -d ':' p; do - if ! cd "$p/src/$PKG" 2>/dev/null; then - continue - fi +# The path separator is ; on windows. +if [ "$(go env GOOS)" = "windows" ]; then + PATHSEP=';' +else + PATHSEP=':' +fi + +while read -d "$PATHSEP" p; do + [ -d "$p/src/$PKG/" ] || continue + cd "$p/src/$PKG" || continue if [ "$DIR" = "$(pwd -P)" ]; then exit 0