When introduced the intended use of %gobuildflags was to make it easy to use the default build flags in packages that has small parts written in Go.
%gobuildflags
The problem is that the LDFLAGS and BUILDTAGS variables expansion outputs single quoted strings, breaking its applicability in the original intended use case.
LDFLAGS
BUILDTAGS
For example:
%make_build GOBUILDFLAGS="%gobuildflags" all
will not work as it will be expanded to:
/usr/bin/make -O -j6 V=1 VERBOSE=1 SBINDIR=/usr/sbin CGO_REQUIRED=1 'GOBUILDFLAGS=-buildmode pie -compiler gc -tags=rpm_crashtraceback' ' -a -v -x -ldflags -Wl,-z,relro' -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes -B 0x459a73285ac8d01b2a750eb13002f82302c547dd -compressdwarf=false -linkmode=external -extldflags '-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes ' all
Note that the single quote resulted from the expansion of ${BUILDTAGS:-} in the %gobuildflags will match the single quote before GOBUILDFLAGS added by the %make_build macro
${BUILDTAGS:-}
GOBUILDFLAGS
%make_build