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 <yselkowi@redhat.com>
This commit is contained in:
Yaakov Selkowitz 2021-08-11 19:15:30 -04:00
parent a818ec4346
commit 67e14290aa

View File

@ -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