From 7e01702a8827529b48f131ca287cf498391ff88b Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Tue, 16 Apr 2019 09:56:38 -0400 Subject: [PATCH] Move "-s -w" flags to GOLDFLAGS as an overridable default. If GOLDFLAGS is set, whether it is empty or not, we should honor it. Only if the GOLDFLAGS is totally not set, then we use "-s -w" See Parameter Expansion section in the urls below: https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash/16753536 http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02 Change-Id: I826c34efc63c77f0e3e9677fff30a3eb2219a377 --- hack/.shellcheck_failures | 1 + hack/lib/golang.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hack/.shellcheck_failures b/hack/.shellcheck_failures index 400203d0fe4..e8cc7a4fed8 100644 --- a/hack/.shellcheck_failures +++ b/hack/.shellcheck_failures @@ -27,6 +27,7 @@ ./hack/cherry_pick_pull.sh ./hack/ginkgo-e2e.sh ./hack/grab-profiles.sh +./hack/lib/golang.sh ./hack/lib/init.sh ./hack/lib/swagger.sh ./hack/lib/test.sh diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh index 36f9f437e84..47133ad74e3 100755 --- a/hack/lib/golang.sh +++ b/hack/lib/golang.sh @@ -693,7 +693,7 @@ kube::golang::build_binaries() { host_platform=$(kube::golang::host_platform) local goflags goldflags goasmflags gogcflags - goldflags="${GOLDFLAGS:-} -s -w $(kube::version::ldflags)" + goldflags="${GOLDFLAGS=-s -w} $(kube::version::ldflags)" goasmflags="-trimpath=${KUBE_ROOT}" gogcflags="${GOGCFLAGS:-} -trimpath=${KUBE_ROOT}"