From 8effbdc63feb7007bde3b76d5bce2949870de3f0 Mon Sep 17 00:00:00 2001 From: Filipe Brandenburger Date: Wed, 3 Sep 2014 14:19:36 -0700 Subject: [PATCH 1/2] In `hack/test-go.sh` treat arguments that start with a dash as go flags. This fixes `hack/test-go.sh pkg/apiserver -test.run=` which was broken by PR #1116. Signed-off-by: Filipe Brandenburger --- hack/test-go.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) 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) From 3d03b4b80f722f00e8f125676f48ec78c881f4cf Mon Sep 17 00:00:00 2001 From: Filipe Brandenburger Date: Wed, 3 Sep 2014 14:58:45 -0700 Subject: [PATCH 2/2] Also assume arguments starting with dashes are go flags in `hack/build-go.sh` Tested: $ hack/build-go.sh cmd/kubelet -v github.com/GoogleCloudPlatform/kubernetes/pkg/... Signed-off-by: Filipe Brandenburger --- hack/build-go.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/hack/build-go.sh b/hack/build-go.sh index 0f4c2c07d1b..a6075fddbaa 100755 --- a/hack/build-go.sh +++ b/hack/build-go.sh @@ -44,14 +44,19 @@ if [[ $# == 0 ]]; then plugin/cmd/scheduler fi -binaries=() -for arg; do - binaries+=("${KUBE_GO_PACKAGE}/${arg}") -done - # Use eval to preserve embedded quoted strings. eval "goflags=(${GOFLAGS:-})" +binaries=() +for arg; do + if [[ "${arg}" == -* ]]; then + # Assume arguments starting with a dash are flags to pass to go. + goflags+=("${arg}") + else + binaries+=("${KUBE_GO_PACKAGE}/${arg}") + fi +done + # Note that the flags to 'go build' are duplicated in the salt build setup # (release/build-release.sh) for our cluster deploy. If we add more command # line options to our standard build we'll want to duplicate them there. As we