(address . guix-patches@gnu.org)(name . Jørgen Kvalsvik)(address . j@lambda.is)
Hi all,
I wrote a downloader+build system for go that is module aware. It
builds on a few slightly different assumptions than the go build system,
but if you have worked on that most should feel familiar. I am posting
these patches to get some feedback and to check with you if this
approach is even viable, or if I should abandon it altogether. My real
goal has been to build hugo, a popular website generator, which has a
large list of dependencies, most of them in go.
Go itself has pretty strong ideas on how to compose systems. In
particular, it wants to statically link everything, pin every dependency
and transitive dependency (combining build system with packaging and
distribution), and strongly prefer full-source builds. This causes some
friction.
These patches chooses to just roll with it, and uses go mod
downloaditself to fetch sources and create a large image of all the
dependencies a project needs to build. This effectively makes it
pointless to package libraries, as the programs using the libraries
would get them from source anyway, but fixing that is future work.
There are a few things I would like to try to do (re-using built
libraries and storing each module in a separate derivation in
particular), but I don't want to tackle that problem unless there is
real interest for this approach.
Thoughts?
Jørgen Kvalsvik (4):
guix: Add go module fetcher
guix: add go module aware build system
guix: Add module aware 'guix import go'
gnu: Add go-buf.
Makefile.am | 2 +
gnu/packages/golang-xyz.scm | 63 +++++++++---
guix/build-system/go.scm | 120 ++++++++++++++++++++++
guix/build/go-mod-build-system.scm | 154 +++++++++++++++++++++++++++++
guix/go-mod-download.scm | 146 +++++++++++++++++++++++++++
guix/import/go.scm | 88 ++++++++++-------
guix/scripts/import/go.scm | 6 ++
7 files changed, 532 insertions(+), 47 deletions(-)
create mode 100644 guix/build/go-mod-build-system.scm
create mode 100644 guix/go-mod-download.scm
base-commit: 33665c52c4670bc3b4d337c89ac9cc6c4c69b26f
--
2.39.5