Message ID | 20250513094023.348947-1-j@lambda.is |
---|---|
Headers |
Return-Path: <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 5619427BC4B; Tue, 13 May 2025 10:41:22 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 3EBBB27BC49 for <patchwork@mira.cbaines.net>; Tue, 13 May 2025 10:41:21 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <guix-patches-bounces@gnu.org>) id 1uEm8K-0000wg-1j; Tue, 13 May 2025 05:41:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1uEm8F-0000wK-HC for guix-patches@gnu.org; Tue, 13 May 2025 05:41:03 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1uEm8F-0004xV-7V for guix-patches@gnu.org; Tue, 13 May 2025 05:41:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=kByyZYqV0N9BCT9kukwtYoYBZGLA+EtPPxBFe46VQks=; b=pYmETn59wV/2ikw2um1e+ZyUKFvHB4loQ41JHmDfb1i0NqeSIj+NDVdPrhKfoe0F5lsRwdNkLw14bQfJu4YUsQLQrsuXDNwre/z033xQ33DYEHm6Afy6CpqJJ71Je5tQSFkn+RzVt4uijySC9OI/o8G6i5sI/T1Owk9JwVtQQdlpli+Cr2ncmZ7xbA+s3RNMFT/Xl0hxVAEJqAzspTprBPL1ig8Yo4MvaLjgtRPjWVKBoh3+YMbdzWi4XQCE1Cr+jmhe0bLESI9CBZrBJydoQXDQJETgsBWcHC+UERXANRkcHmKvpL5CU1XNIs4a+AR7gFRyN8BmXezB0wCemkZEJQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1uEm8E-00087r-Rb for guix-patches@gnu.org; Tue, 13 May 2025 05:41:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78404] [PATCH 0/2] Go: Module aware build system Resent-From: =?utf-8?q?J=C3=B8rgen?= Kvalsvik <j@lambda.is> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 13 May 2025 09:41:02 +0000 Resent-Message-ID: <handler.78404.B.174712925831211@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 78404 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 78404@debbugs.gnu.org Cc: =?utf-8?q?J=C3=B8rgen?= Kvalsvik <j@lambda.is>, steve@futurile.net X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.174712925831211 (code B ref -1); Tue, 13 May 2025 09:41:02 +0000 Received: (at submit) by debbugs.gnu.org; 13 May 2025 09:40:58 +0000 Received: from localhost ([127.0.0.1]:58050 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1uEm89-00087K-KL for submit@debbugs.gnu.org; Tue, 13 May 2025 05:40:58 -0400 Received: from lists.gnu.org ([2001:470:142::17]:34926) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <j@lambda.is>) id 1uEm83-00086u-SG for submit@debbugs.gnu.org; Tue, 13 May 2025 05:40:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <j@lambda.is>) id 1uEm7r-0000uh-OP for guix-patches@gnu.org; Tue, 13 May 2025 05:40:40 -0400 Received: from mx.kolabnow.com ([212.103.80.155]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <j@lambda.is>) id 1uEm7n-0004w0-ME for guix-patches@gnu.org; Tue, 13 May 2025 05:40:39 -0400 Received: from localhost (unknown [127.0.0.1]) by mx.kolabnow.com (Postfix) with ESMTP id 7795A30051EA; Tue, 13 May 2025 11:40:30 +0200 (CEST) Authentication-Results: ext-mx-out013.mykolab.com (amavis); dkim=pass reason="pass (just generated, assumed good)" header.d=lambda.is DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lambda.is; h= content-transfer-encoding:content-type:content-type:mime-version :message-id:date:date:subject:subject:from:from:received :received:received; s=dkim2; t=1747129229; x=1748943630; bh=kByy ZYqV0N9BCT9kukwtYoYBZGLA+EtPPxBFe46VQks=; b=dtF/zZMJwc46pyQftwBw Gnb++hJGuM6i5b/oq9Q4WLWBb7YRcRe04xwDpOoVTN8VTYWwlyDBcKyc/V7yWMee zc1rLvBUOrneiM60PEcxtXa1XKX4bPcR+ZfIJMI4Foeqs4+H4/FSlrAa14rh+I1j CKPfwBj7I7/gnGk9IfFtDIfjThV7Aa0JSPHCCCrIFUUNI3HVpMBMaPygpZUFXx7s YRNZ0e/tnej42bBUvPolaEhr2Hhmc0o/h8QNSwotEuiqOY6Q2uow7motEq6duC6K WuhbwpGC31q871OXvXJXSOWm/VcVFU6hjzqxXcnsqQw1YPYMjq7KRUsw3vIk7wMg XQ== X-Virus-Scanned: amavis at mykolab.com Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out013.mykolab.com [127.0.0.1]) (amavis, port 10024) with ESMTP id 5z85xvDWD2LT; Tue, 13 May 2025 11:40:29 +0200 (CEST) Received: from int-mx011.mykolab.com (unknown [10.9.13.11]) by mx.kolabnow.com (Postfix) with ESMTPS id 07B9E30051E3; Tue, 13 May 2025 11:40:28 +0200 (CEST) Received: from ext-subm010.mykolab.com (unknown [10.9.6.10]) by int-mx011.mykolab.com (Postfix) with ESMTPS id 97BE832085EE; Tue, 13 May 2025 11:40:28 +0200 (CEST) From: =?utf-8?q?J=C3=B8rgen?= Kvalsvik <j@lambda.is> Date: Tue, 13 May 2025 11:40:23 +0200 Message-Id: <20250513094023.348947-1-j@lambda.is> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=212.103.80.155; envelope-from=j@lambda.is; helo=mx.kolabnow.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: <guix-patches.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guix-patches> List-Post: <mailto:guix-patches@gnu.org> List-Help: <mailto:guix-patches-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=subscribe> Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches |
Series |
Go: Module aware build system
|
|
Message
Jørgen Kvalsvik
May 13, 2025, 9:40 a.m. UTC
Hi, This is a new build system for go, based on go modules. I'm submitting this now to get an issue number, collect some feedback, and iron out the last few wrinkles, but we have used an internal version of it for a while and it works well for us. I have tweaked it a bit in preparation for this patch series, and I do expect it to take a couple of iterations. The new build system can use packages built with go-build-system as inputs, which I think is a prerequisite. There is already a large collection of go libraries in guix, and we want to use that work well. That being said, this build system should graudually replace the go-build-system. Because they are (largely) compatible as inputs, packages can be migrated gradually. The library or program being built does not have to be "module aware" (have a go.mod file) to use this build system, a new go.mod will be created unconditionally. It addresses most of the shortcomings of the current go build system. Here's the list from go.scm and how this system is different: * Avoid copying dependencies into the build environment and / or avoid using a tmpdir when creating the inputs union. We still copy build dependencies into the build dir, so that go build can "fetch" dependencies as it likes. There is a path where this can be avoided by using replace directives in go.mod, but this is a significant complication and requires build inputs to be proper modules, which is not guaranteed. * Use Go modules Yes. * Re-use compiled packages Yes. We install the go build cache under $out/var, and seed downstream builds with this cache. * Avoid the go-inputs hack Sort-of? We look at package name, but also the "shape" of the package, namely the presence of the src/ directory. This seems to work ok. * Remove module packages, only offering the full Git repos? This is more idiomatic, I think, because Go downloads Git repos, not modules. There is the go-mod-fetch which downloads modules (as zips). The build system does not particularly care about the source, and works well both with git clone, hg clone, and url fetch. * Figurie out how to passthrough --verbosity option to "build" and "check" Not addressed yet. * Implement test-backend option, which would be similar to pyproject's one, allowing to provide custom test runner. Not really, but most go projects are just tested with `go test ./...` or `go test ./dir1 ./dir2 ...`. There are options for both test flags and test targets. Anything else probably warrants a custom check phase. I have a prototype of guix import go-module ..., too, but it's not quite ready yet. I will add onto this series a few packages to demonstrate the build system, and port a few packages from go-build-system to go-module-build-system. Jørgen Kvalsvik (2): guix: Add downloader for go modules from GOPROXY guix: Add module-aware build system for go Makefile.am | 3 + guix/build-system/go-module.scm | 268 +++++++++++++++ guix/build/go-module-build-system.scm | 457 ++++++++++++++++++++++++++ guix/go-mod-download.scm | 126 +++++++ 4 files changed, 854 insertions(+) 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