diff --git a/hack/test-go.sh b/hack/test-go.sh index 8f096f08a20..ff247c09d47 100755 --- a/hack/test-go.sh +++ b/hack/test-go.sh @@ -94,6 +94,17 @@ shift $((OPTIND - 1)) # Use eval to preserve embedded quoted strings. eval "goflags=(${GOFLAGS:-})" +# Filter out arguments that start with "-" and move them to goflags. +testcases=() +for arg; do + if [[ "${arg}" == -* ]]; then + goflags+=("${arg}") + else + testcases+=("${arg}") + fi +done +set -- ${testcases[@]+"${testcases[@]}"} + if [[ "${iterations}" -gt 1 ]]; then if [[ $# -eq 0 ]]; then set -- $(find_test_dirs)