From 67e14290aae184217a3231982ae35ee4bd77688d Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Wed, 11 Aug 2021 19:15:30 -0400 Subject: [PATCH] Fix build with multiple GOFLAGS The tag extraction from GOFLAGS doesn't do anything if -tags is not present in GOFLAGS. Not only does that mean non-sensical tags are passed, but because GOFLAGS is a space-separated variable, the build will fail because the build flags because -tags must be comma-separated. Signed-off-by: Yaakov Selkowitz --- hack/lib/golang.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh index e7ead24ef71..3df96b467df 100755 --- a/hack/lib/golang.sh +++ b/hack/lib/golang.sh @@ -807,7 +807,7 @@ kube::golang::build_binaries() { # extract tags if any specified in GOFLAGS # shellcheck disable=SC2001 - gotags="selinux,notest,$(echo "${GOFLAGS:-}" | sed -e 's|.*-tags=\([^-]*\).*|\1|')" + gotags="selinux,notest,$(echo "${GOFLAGS:-}" | sed -ne 's|.*-tags=\([^-]*\).*|\1|p')" local -a targets=() local arg