From ce22322ef16e0915bd4b17081f7ce97533cd65f4 Mon Sep 17 00:00:00 2001 From: Yecheng Fu Date: Mon, 19 Nov 2018 15:23:54 +0800 Subject: [PATCH] No need to pass GOFLAGS to $goflags variables. In go 1.11, go commands will use `GOFLAGS` as default flags, see https://golang.org/doc/go1.11#go_command. There is no need to pass GOFLAGS to $goflags, and if we do, go commands will fail with "duplicate flags" error, e.g. ``` $ make test-integration WHAT=./test/integration/scheduler GOFLAGS="-v" ... go test: v flag may be set only once run "go help test" or "go help testflag" for more information ... ``` --- hack/lib/golang.sh | 2 -- hack/make-rules/test.sh | 1 - hack/make-rules/vet.sh | 3 --- 3 files changed, 6 deletions(-) diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh index 7ddc0bb79bf..e01e3a745a2 100755 --- a/hack/lib/golang.sh +++ b/hack/lib/golang.sh @@ -677,9 +677,7 @@ kube::golang::build_binaries() { local host_platform host_platform=$(kube::golang::host_platform) - # Use eval to preserve embedded quoted strings. local goflags goldflags goasmflags gogcflags - eval "goflags=(${GOFLAGS:-})" goldflags="${GOLDFLAGS:-} -s -w $(kube::version::ldflags)" goasmflags="-trimpath=${KUBE_ROOT}" gogcflags="${GOGCFLAGS:-} -trimpath=${KUBE_ROOT}" diff --git a/hack/make-rules/test.sh b/hack/make-rules/test.sh index 3a64cdb404c..95893a0e0ca 100755 --- a/hack/make-rules/test.sh +++ b/hack/make-rules/test.sh @@ -171,7 +171,6 @@ done shift $((OPTIND - 1)) # Use eval to preserve embedded quoted strings. -eval "goflags=(${GOFLAGS:-})" eval "testargs=(${KUBE_TEST_ARGS:-})" # Used to filter verbose test output. diff --git a/hack/make-rules/vet.sh b/hack/make-rules/vet.sh index 65a0d4945f9..bdfe8e5af5a 100755 --- a/hack/make-rules/vet.sh +++ b/hack/make-rules/vet.sh @@ -35,9 +35,6 @@ fi # See https://github.com/golang/go/issues/16086 for details. go install ./cmd/... -# Use eval to preserve embedded quoted strings. -eval "goflags=(${GOFLAGS:-})" - # Filter out arguments that start with "-" and move them to goflags. targets=() for arg; do