SPEC: enable default Go modules behavior on Fedora

It turns out, that Fedora Go RPM macros are disabling the Go modules
support by default for all builds. The reason seems to be the worry that
some Go macros may not support it. However, it is not disabled by
default on CentOS Stream or RHEL and the package builds just fine.

On Fedora, undefine the macro which explicitly passes `GO111MODULE=off`
to each build, to use the default compiler behavior instead.

Additional relevant info:
https://pagure.io/go-rpm-macros/c/35bd72648fe6cfa372f886b5692936ffb5b4389a
https://pagure.io/go-rpm-macros/c/df8452a5df762d8df1e871a103bc05a58c24cb8d

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2023-09-26 13:46:24 +02:00 committed by Tomáš Hozza
parent 95169111de
commit 191406d35b

View file

@ -78,6 +78,11 @@ export PATH=$PWD/_bin${PATH:+:$PATH}
export GOPATH=$GO_BUILD_PATH:%{gopath}
export GOFLAGS+=" -mod=vendor"
%endif
%if 0%{?fedora}
# Fedora disables Go modules by default, but we want to use them.
# Undefine the macro which disables it to use the default behavior.
%undefine gomodulesmode
%endif
# Set the commit hash so that composer can report what source version
# was used to build it. This has to be set explicitly when calling rpmbuild,