On Tue Apr 2, 2024 at 17:16 +0200, Dan Čermák wrote:
Hi Maxwell & Go SIG,
Hi Dan,
Thank you for reaching out!
we have recently started working on introducing a bundled() provides
generator for golang in openSUSE and found a very simple solution using
the output of `go version -m /path/to/binary` [1]
It seems that only works when builds are performed with GO111MODULE
turned on[1]. We have it turned off by default, although I suppose we
can turn it on when doing vendored builds—we only need to turn it off
when using the RPM-packaged dependencies for un-vendored packages.
Without GO111MODULE, the dep information doesn't show up with "go
version -m."
[1]
https://go.dev/blog/go116-module-changes
The solution is of course only that simple, because we build more or
less all go binaries with vendored dependencies and hence we do not need
to distinguish between those build with vendored and those build
without.
As I would like to align the Fedora and openSUSE go packaging closer
together and hence, if possible, find a solution to use this generator
for both Fedora and openSUSE. I think it is a bit simpler and does not
require to ship the modules.txt in the final rpm. However, I see that
both are rather weak reasons.
Do you see a way how we can find a common solution? E.g. by having a
macro %go_enable_bundled_provides that would set an environment variable
and enable the bundled generator?
Other than the technical issue with GO111MODULE, I still prefer
modules.txt approach. It is more efficient, as we don't need to process
every single binary file in the package, and it requires explicit opt-in
from the packager.
Best,
Maxwell