GNU bug report logs - #78404
[PATCH 0/2] Go: Module aware build system

Previous Next

Package: guix-patches;

Reported by: Jørgen Kvalsvik <j <at> lambda.is>

Date: Tue, 13 May 2025 09:41:02 UTC

Severity: normal

Tags: patch

Done: Sharlatan Hellseher <sharlatanus <at> gmail.com>

Full log


Message #23 received at 78404 <at> debbugs.gnu.org (full text, mbox):

From: Jørgen Kvalsvik <j <at> lambda.is>
To: 78404 <at> debbugs.gnu.org
Cc: Jørgen Kvalsvik <j <at> lambda.is>
Subject: [PATCH 0/4] Go module aware build system
Date: Thu, 15 May 2025 10:16:31 +0200
Hi,

Here's a slightly revised patch series which fixes a couple of issues.

`go build` is now invoked in a loop, which allows specifying both patterns and
specific binaries. I needed this for a test case where a project built
internal/echo-plugin for use in tests. There is no real downside to doing this
in a loop as far as I am aware, and install is uses a loop.

I also fixed cross compiling. I did not test it extensively, but cross
compiling using the go-build-system doesn't seem to work well, because it sets
the GOBIN env var, which makes the compiler error out.

From my x86_64-linux system:

    ~$ file $(guix build go-ulid --target=x86_64-linux-gnu)/bin/ulid
    /gnu/store/i258kcbn5g8s97bz26q2rkic7ar5667d-go-ulid-2.1.0/bin/ulid:
    ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked,
    Go BuildID=_VaiUxKWsiIAlkWq7ODq/4GeipEcLMBNQHuHSA3kh/kxL5wZXJ8V0hvXEoJaF4/hO3bq-ZKZ51CEH4uY7rc, stripped

    ~$ file $(guix build go-ulid --target=aarch64-linux-gnu)/bin/ulid
    /gnu/store/f4yzrwd198xhk4194xrfvqdk5yqz0nac-go-ulid-2.1.0/bin/ulid:
    ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked,
    Go BuildID=Z_1o0etV-eeUchVexa3A/bUxxm0FmCf6iLc1enI_T/ET4MK0HAx8OyRYBFV73n/j-RubHuPPW1R02OqsNu9, stripped

    ~$ file $(guix build go-ulid --target=arm-linux-gnueabihf)/bin/ulid
    /gnu/store/q6f1l82bl1lpvrciibkiffjfsxn8vz0x-go-ulid-2.1.0/bin/ulid: ELF
    32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked,
    Go BuildID=NVoNI56N4Ri60CnAR78t/9bQS_Y8jZabn5Y1v80w-/D1_8mW1gwE0Bdtx-heU-/aU1ZqDUxXoi_ToBSeHUL, stripped


I also added two demos, so it would be easier for you to try and to show the
compatibility between packages using the two build systems.  One is an
executable, and one where is a library.

~$ guix build go-github-com-burntsushi-toml go-ulid

Jørgen Kvalsvik (4):
  guix: Add downloader for go modules from GOPROXY
  guix: Add module-aware build system for go
  gnu: Build go-ulid with go-module-build system
  gnu: Build with go-module-build-system

 Makefile.am                           |   3 +
 gnu/packages/golang-xyz.scm           |  13 +-
 guix/build-system/go-module.scm       | 267 +++++++++++++++
 guix/build-system/zig.scm             |   4 +-
 guix/build/go-module-build-system.scm | 473 ++++++++++++++++++++++++++
 guix/go-mod-download.scm              | 126 +++++++
 6 files changed, 877 insertions(+), 9 deletions(-)
 create mode 100644 guix/build-system/go-module.scm
 create mode 100644 guix/build/go-module-build-system.scm
 create mode 100644 guix/go-mod-download.scm

-- 
2.39.5





This bug report was last modified 24 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.