GNU bug report logs - #44178
Add a Go Module Importer

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Katherine Cox-Buday <cox.katherine.e@HIDDEN>; dated Fri, 23 Oct 2020 14:08:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 44178 <at> debbugs.gnu.org:


Received: (at 44178) by debbugs.gnu.org; 29 Jan 2021 16:52:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 29 11:52:19 2021
Received: from localhost ([127.0.0.1]:52871 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l5X0D-00018e-C1
	for submit <at> debbugs.gnu.org; Fri, 29 Jan 2021 11:52:19 -0500
Received: from mx07-00115501.pphosted.com ([185.132.182.48]:41916
 helo=mx08-00115501.pphosted.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <prvs=9663a57d84=francois.joulaud@HIDDEN>)
 id 1l5X0A-00018S-Sd
 for 44178 <at> debbugs.gnu.org; Fri, 29 Jan 2021 11:52:08 -0500
Received: from pps.filterd (m0001505.ppops.net [127.0.0.1])
 by mx07-00115501.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id
 10TGjF1R022815
 for <44178 <at> debbugs.gnu.org>; Fri, 29 Jan 2021 17:52:05 +0100
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=radiofrance.com;
 h=from : to :
 subject : date : message-id : references : in-reply-to : content-type :
 content-id : content-transfer-encoding : mime-version;
 s=radiofrance20190306; bh=A2tAJyG7PGX6eZE66F0SE7XwtkHHRJ63IU6ic7Q+oE4=;
 b=L6/E/6UyJndijpRIARoLlxgTetCPgchC2JGKxryJmiqDXbsGW5zSSVZwPGXNav+gDQZ4
 rf0rnZgpg4oXMkv+LOrggrOQha0lh07i9Wqk2kwc7gNiFf5MFf4kkvkzx+z32fNZjTjD
 +I7jRYpYdPv/L1D2C7Uydi0k5EM8xsDXtuFvVPWG7cEqbdtLo5NaNpm2BzN69v2+NcFt
 p+x5HhFpJe0T2qsyzqNu0HyXyW7sD0k0GECA51K1addapckyz8jNNcm2n78gQwaqbgW/
 pohyfsw/bf1BjHZ2swUbB5Fc+FjB19IgrK68XklHlUsk5OYshiou6dwP74V06ekgZtF5 4g== 
Received: from fra01-pr2-obe.outbound.protection.outlook.com
 (mail-pr2fra01on0108.outbound.protection.outlook.com [104.47.24.108])
 by mx07-00115501.pphosted.com with ESMTP id 36895rjwty-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <44178 <at> debbugs.gnu.org>; Fri, 29 Jan 2021 17:52:04 +0100
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=O5fWt0xE0sjizVYjQNrSVrFA8ewM2NQJofTDAgDSh4eslQdFLbWXfPK019j8Jhiz0AFHE8lRRVPyzlsKcrd45LG8/p3uxjI8JjckDtcV8u2BclcY8ztSfb0USNQyDcIoUyTZ/2zTz7iDcYO44Gdnfa+z+UAxGV+6dMVUNurcyx9oRBB2P8tqDQT50uM2DupzQQEKblI1in0r1DeF+DDRCEdlYvFgV/gTechQYu45PKh2YPFbIDUpW2sgHNQlJ50mC4+9+gsWkRt6aapABl8BGO+ezL3Td/oGFs7OsaXzyuVJXUVqhXq0drMMJiu98qlsWLGZYrVdESfj9RhCoFW26A==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=A2tAJyG7PGX6eZE66F0SE7XwtkHHRJ63IU6ic7Q+oE4=;
 b=hYmV/HKoS+nJIJQaIeCBJHyEaf0G4i/F5vtgX8sQT72nOWqZoVm/oUd4qogAtmR8uriI5z3tK6g5w031K0ViNv2zdW1LL+U2uT2MDnczpUmEs9IWQswi9fED15R39lHyLNhH1P7yQ8SxiCkofv/rvw8kf4pdYhI5bUPShdpHXI4VTDZBwVULkIrqWXDTpgYmS0MhoBYJ8FeouhXvNiVc4G9790J5j07b6pJ5N43yJkiz+j7f3bvTK3F6FPO0bEp0BOAM2gwXY4uuxZhA7cMEC2J581Bb4KkrChUgxR/9XvnzDeR7kkG0YaWnbKl4F4kEd5TlLIFS6RFLHhxG9O05XA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=radiofrance.com; dmarc=pass action=none
 header.from=radiofrance.com; dkim=pass header.d=radiofrance.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=RFonline.onmicrosoft.com; s=selector2-RFonline-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=A2tAJyG7PGX6eZE66F0SE7XwtkHHRJ63IU6ic7Q+oE4=;
 b=ZwHqKLQChaXxjaVtjen4QAAmIdL2TQPdiCwhdN/G/dqB9UF6OinQpyqmS7GeCgY5EgtVRlkHi3YVTjsVQaa170LGQM9KBb4fNvC9GyPVO0tRCDsavrgsBkBs35MiN3ngEM1uigWEy0MB3xS8lLOrKRDWHIm7ER9AP6BHNY0jsDQ=
Received: from PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:b::20) by
 PR0P264MB0572.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:4::12) with
 Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.3742.12; Fri, 29 Jan 2021 16:52:03 +0000
Received: from PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM
 ([fe80::51bc:289d:ff1a:6b58]) by PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM
 ([fe80::51bc:289d:ff1a:6b58%6]) with mapi id 15.20.3784.017; Fri, 29 Jan 2021
 16:52:03 +0000
From: =?iso-8859-1?Q?JOULAUD_Fran=E7ois?= <Francois.JOULAUD@HIDDEN>
To: "44178 <at> debbugs.gnu.org" <44178 <at> debbugs.gnu.org>
Subject: [PATCHv2] Create importer for Go modules
Thread-Topic: [PATCHv2] Create importer for Go modules
Thread-Index: AQHW9l8RwPhX3/Q56k6NvVPLE/X+iw==
Date: Fri, 29 Jan 2021 16:52:02 +0000
Message-ID: <20210129164827.vrrty5gmi4paf7xv@HIDDEN>
References: <20210129163945.irrdlm3updejkcsg@HIDDEN>
In-Reply-To: <20210129163945.irrdlm3updejkcsg@HIDDEN>
Accept-Language: fr-FR, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
authentication-results: debbugs.gnu.org; dkim=none (message not signed)
 header.d=none;debbugs.gnu.org; dmarc=none action=none
 header.from=radiofrance.com;
x-originating-ip: [88.126.13.52]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 3b60d1ec-9488-4a48-add1-08d8c47633fb
x-ms-traffictypediagnostic: PR0P264MB0572:
x-ms-exchange-transport-forked: True
x-microsoft-antispam-prvs: <PR0P264MB0572D99FE9130F83133B0F0396B99@HIDDEN>
x-ms-oob-tlc-oobclassifiers: OLM:4502;
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: Rjs3Xx1RQMyvZ+se3YobzuhAeRpJkM05hqJ46dhuy7XbKjCKYVbs6+fnsRv602gz+9dsEJTwvDLuEmng1msyeIqJaF69tBKDWF7RCYuUcFLEohsc9mvi/sGCQij/RHLd+qh7IJ/r0NJOduNxZVXH1Jg+dbhkPij+myGKQxZ0KioDfRu9UFF6d38jitMUjNR6phB5WGUJsyza44Y4bqWu2hezN8RX60l+eV6mSu+Kt9SylPBsUVy9mbZn9LXsTtTjJcgQ+MqOJYzzYZr687JuSEeBQtCj3Rw/1RiiWOEFmrR2MsglZeKu0hXeTUXNvfNikxYQVV1wWHpmsR5SAmmAs/fipGBhlEy12YHhCB2jNl80o/Mcf/mnGwKTvYSeEef6RBs9uk3GeXMEzMDO5wf9V1Zwb+ar8OeviNGp/Yb9q4uArG3WvlOmQKBJKJEW4bQsi+CJ6jdMioB5FSmvopbKu5pnhPojIdhm7WPZOwyih3grKypCmDAlEqeD/VKm5DgfhNTnUgRub+nA1f6ZQly9uWDny7jYOkSwyeOyowYplN5KtRrSMXuf59+J4lP97FXANNro3np88SoJ1eV8IanKs34RTWKz8HrBbDb2Wf12vO/ixphI3N33LGfrVS9jvsOv6WMLjK2Sab3AVMkoqIk3tQ==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM; PTR:; CAT:NONE;
 SFS:(4636009)(376002)(39860400002)(396003)(346002)(136003)(366004)(66476007)(66574015)(76116006)(66946007)(6486002)(66556008)(966005)(5660300002)(186003)(478600001)(86362001)(66446008)(26005)(71200400001)(8936002)(2906002)(316002)(64756008)(9686003)(6512007)(83380400001)(30864003)(6506007)(1076003)(6916009)(8676002)(2004002)(579004)(559001);
 DIR:OUT; SFP:1101; 
x-ms-exchange-antispam-messagedata: =?iso-8859-1?Q?5Rot5tK4sjd+E4mAXcKmoTIxGxs+xHdsPq/o/YFO7lIx8XZ4X16sO7D0C0?=
 =?iso-8859-1?Q?+S4FdHUoZ+LDckJP8ZJUEZNozCHoaYr7oJYQUocx+6/qaCAeW44iMxRfXZ?=
 =?iso-8859-1?Q?31btcvOGVMWKTa3tNHvlPzKSUN+5dDMhrSbNBAIZ8s0W3jr30snhp42j47?=
 =?iso-8859-1?Q?aubQUuYFb+pP1bB+qIzJe50Xxtv9EhHs0ZYC38GuUZdUl5Es1hfNdeMdYl?=
 =?iso-8859-1?Q?G7UT0oW8f709sx4DQ8xxbxHOSQ2zhDIYpsnKy10PZI4odsL2ZInTSyLBmp?=
 =?iso-8859-1?Q?dqGBeQmrL84hJBD5WdomTqmS2SozlsZOAbwOvXK+vakYKNcilbU6kUQMeS?=
 =?iso-8859-1?Q?hfXEoTDuKFpnQBOQzWXhacaIiyqCzRuA8jwXJHyrR3kq1E19Dm+SzgKqs2?=
 =?iso-8859-1?Q?66uOcaXyh4JcTmS0b0wWftQB9stQLMaD/U29bBOJovH6sos8Wtf5YM6iQp?=
 =?iso-8859-1?Q?XBnJ2LFf6/wQxxTeFQe+G33WdtPaiAw1VoJUYzi47nD38UWCwA/AuvoIWt?=
 =?iso-8859-1?Q?3ee8xkKE4oN7bgBqq+u2K7R0+7TK/oY7gTdJR/nbzEhUOt8Ido2roLaJJA?=
 =?iso-8859-1?Q?Zvbyj9TS1j/yH1yimIUqyuRBQd/rm/3A3ECyyC9/Bhvf04wdCiNPEqpwMd?=
 =?iso-8859-1?Q?QmBqSVq9RaTxgyjy40Rp0Jl0P+4b45gTwowWtt/XAfOEJvkgfudVz689yT?=
 =?iso-8859-1?Q?xZ9t5a6Z2ZHSAMx0sPJnLcubBPLvkMyNgho7U3C7WcuTZoeHi4hSUdPLVz?=
 =?iso-8859-1?Q?dmSPFQg/xz4PUlHgpRC1GID+xA3y+TE7SKB5neBVY2NZsRLA9bDsyT2q63?=
 =?iso-8859-1?Q?wznbTWmxVHeFD60b0agXAanBPzDQmCa4zPDkEQycvQ/fVibixG0ahMHFfG?=
 =?iso-8859-1?Q?q7TCmpS1g8BdMzJrGu7Y9JvjbCAa8DKU4DMV6nzxbx80HOMIdiSs109cJv?=
 =?iso-8859-1?Q?PZFqj2Yo4H2+D1PYWBoiZqugjqfIaNSeQnSXcf8oCruXeHunlv8Jl8LKmt?=
 =?iso-8859-1?Q?CSRqzNCppcCIiV5mwzCF6/TUfNN0S1OH8dCnp4rALEHGZbr+GRxz5hb9Mh?=
 =?iso-8859-1?Q?ygXIhqTvlHLWHh+bDCaYhNb3HrNqhfBiPIlCjtRjg8/c?=
Content-Type: text/plain; charset="iso-8859-1"
Content-ID: <24A251FD2E97CE4A826BCA2AB96C6DA5@HIDDEN>
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: radiofrance.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-Network-Message-Id: 3b60d1ec-9488-4a48-add1-08d8c47633fb
X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jan 2021 16:52:02.9592 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 1d643b07-8cf5-4e2d-ad1e-86d6b948fc3b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: v3OzlCL/s/lNiQeH4SZ8eDFQLvq9ReNt3/5PZjY+8SofwRnnqnyTeSJp6USc4e0H5UczxPzkrYPhoRRPoArOSYtky4F3t3cnwsvIgXNQQoYSwbqmZXAnBJp/lQ9t1P/i
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR0P264MB0572
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.737
 definitions=2021-01-29_06:2021-01-29,
 2021-01-29 signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0
 clxscore=1015 mlxscore=0
 suspectscore=0 adultscore=0 impostorscore=0 priorityscore=1501 spamscore=0
 phishscore=0 lowpriorityscore=0 mlxlogscore=999 malwarescore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000
 definitions=main-2101290082
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 44178
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)

This patch add a `guix import go` command.

It was tested with several big repositories and seems to mostly work for
the import part (because building Guix packages is an other story).

* guix/import/go.sc: Created Go Importerm
* guix/scripts/import.scm: Added Go Importer Subcommand
* guix/scripts/import/go.scm: Created Go Importer Subcommand
* doc/guix.texi: add a paragraph about `guix import go`
* tests/import-go.scm: tests for parse-go.mod procedure

Signed-off-by: Francois Joulaud <francois.joulaud@HIDDEN>
---
 doc/guix.texi              |  25 +++
 guix/import/go.scm         | 384 +++++++++++++++++++++++++++++++++++++
 guix/scripts/import.scm    |   2 +-
 guix/scripts/import/go.scm | 118 ++++++++++++
 tests/import-go.scm        | 143 ++++++++++++++
 5 files changed, 671 insertions(+), 1 deletion(-)
 create mode 100644 guix/import/go.scm
 create mode 100644 guix/scripts/import/go.scm
 create mode 100644 tests/import-go.scm

diff --git a/doc/guix.texi b/doc/guix.texi
index 6ea782fd23..d77e2811ae 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -860,6 +860,10 @@ substitutes (@pxref{Invoking guix publish}).
 @uref{https://ngyro.com/software/guile-semver.html, Guile-Semver} for
 the @code{crate} importer (@pxref{Invoking guix import}).
=20
+@item
+@uref{https://www.nongnu.org/guile-lib/doc/ref/htmlprag/, guile-lib} for
+the @code{crate} importer (@pxref{Invoking guix import}).
+
 @item
 When @url{http://www.bzip.org, libbz2} is available,
 @command{guix-daemon} can use it to compress build logs.
@@ -11370,6 +11374,27 @@ Select the given repository (a repository name).  =
Possible values include:
       of coq packages.
 @end itemize
 @end table
+
+@item go
+@cindex go
+Import metadata for a Go module using
+@uref{https://proxy.golang.org, proxy.golang.org}.
+
+This importer is highly experimental.
+
+@example
+guix import go gopkg.in/yaml.v2
+@end example
+
+Additional options include:
+
+@table @code
+@item --recursive
+@itemx -r
+Traverse the dependency graph of the given upstream package recursively
+and generate package expressions for all those packages that are not yet
+in Guix.
+@end table
 @end table
=20
 The structure of the @command{guix import} code is modular.  It would be
diff --git a/guix/import/go.scm b/guix/import/go.scm
new file mode 100644
index 0000000000..cf2d31ce12
--- /dev/null
+++ b/guix/import/go.scm
@@ -0,0 +1,384 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright =A9 2020 Katherine Cox-Buday <cox.katherine.e@HIDDEN>
+;;; Copyright =A9 2020 Helio Machado <0x2b3bfa0+guix@HIDDEN>
+;;; Copyright =A9 2021 Fran=E7ois Joulaud <francois.joulaud@HIDDEN=
m>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; (guix import golang) wants to make easier to create Guix package
+;;; declaration for Go modules.
+;;;
+;;; Modules in Go are "collection of related Go packages" which are
+;;; "the unit of source code interchange and versioning".
+;;; Modules are generally hosted in a repository.
+;;;
+;;; At this point it should handle correctly modules which
+;;; - have only Go dependencies;
+;;; - use go.mod;
+;;; - and are accessible from proxy.golang.org (or configured GOPROXY).
+;;;
+;;; We translate Go module paths  to a Guix package name under the
+;;; assumption that there will be no collision.
+
+(define-module (guix import go)
+  #:use-module (ice-9 match)
+  #:use-module (ice-9 rdelim)
+  #:use-module (ice-9 receive)
+  #:use-module (ice-9 regex)
+  #:use-module (htmlprag)
+  #:use-module (sxml xpath)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-9)
+  #:use-module (srfi srfi-11)
+  #:use-module (json)
+  #:use-module ((guix download) #:prefix download:)
+  #:use-module (guix import utils)
+  #:use-module (guix import json)
+  #:use-module (guix packages)
+  #:use-module (guix upstream)
+  #:use-module (guix utils)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix base16)
+  #:use-module (guix base32)
+  #:use-module ((guix build download) #:prefix build-download:)
+  #:use-module (web uri)
+
+  #:export (go-module->guix-package
+            go-module-recursive-import
+            infer-module-root))
+
+(define (go-path-escape path)
+  "Escape a module path by replacing every uppercase letter with an exclam=
ation
+mark followed with its lowercase equivalent, as per the module Escaped Pat=
hs
+specification. https://godoc.org/golang.org/x/mod/module#hdr-Escaped_Paths=
"
+  (define (escape occurrence)
+    (string-append "!" (string-downcase (match:substring occurrence))))
+  (regexp-substitute/global #f "[A-Z]" path 'pre escape 'post))
+
+
+(define (fetch-latest-version goproxy-url module-path)
+  "Fetches the version number of the latest version for MODULE-PATH from t=
he
+given GOPROXY-URL server."
+  (assoc-ref
+   (json-fetch (format #f "~a/~a/@latest" goproxy-url
+                       (go-path-escape module-path)))
+   "Version"))
+
+(define (fetch-go.mod goproxy-url module-path version file)
+  "Fetches go.mod from the given GOPROXY-URL server for the given MODULE-P=
ATH
+and VERSION."
+  (let ((url (format #f "~a/~a/@v/~a.mod" goproxy-url
+                     (go-path-escape module-path)
+                     (go-path-escape version))))
+    (parameterize ((current-output-port (current-error-port)))
+      (build-download:url-fetch url
+                                file
+                                #:print-build-trace? #f))))
+
+(define (parse-go.mod go.mod-path)
+  (parse-go.mod-port (open-input-file go.mod-path)))
+
+(define (parse-go.mod-port go.mod-port)
+  "PARSE-GO.MOD takes a filename in GO.MOD-PATH and extract a list of
+requirements from it."
+  ;; We parse only a subset of https://golang.org/ref/mod#go-mod-file-gram=
mar
+  ;; which we think necessary for our use case.
+  (define (toplevel results)
+    "Main parser, RESULTS is a pair of alist serving as accumulator for
+     all encountered requirements and replacements."
+    (let ((line (read-line)))
+      (cond
+       ((eof-object? line)
+        ;; parsing ended, give back the result
+        results)
+       ((string=3D? line "require (")
+        ;; a require block begins, delegate parsing to IN-REQUIRE
+        (in-require results))
+       ((string=3D? line "replace (")
+        ;; a replace block begins, delegate parsing to IN-REPLACE
+        (in-replace results))
+       ((string-prefix? "require " line)
+        ;; a require directive by itself
+        (let* ((stripped-line (string-drop line 8))
+               (new-results (require-directive results stripped-line)))
+          (toplevel new-results)))
+       ((string-prefix? "replace " line)
+        ;; a replace directive by itself
+        (let* ((stripped-line (string-drop line 8))
+               (new-results (replace-directive results stripped-line)))
+          (toplevel new-results)))
+       (#t
+        ;; unrecognised line, ignore silently
+        (toplevel results)))))
+  (define (in-require results)
+    (let ((line (read-line)))
+      (cond
+       ((eof-object? line)
+        ;; this should never happen here but we ignore silently
+        results)
+       ((string=3D? line ")")
+        ;; end of block, coming back to toplevel
+        (toplevel results))
+       (#t
+        (in-require (require-directive results line))))))
+  (define (in-replace results)
+    (let ((line (read-line)))
+      (cond
+       ((eof-object? line)
+        ;; this should never happen here but we ignore silently
+        results)
+       ((string=3D? line ")")
+        ;; end of block, coming back to toplevel
+        (toplevel results))
+       (#t
+        (in-replace (replace-directive results line))))))
+  (define (replace-directive results line)
+    "Extract replaced modules and new requirements from replace directive
+    in LINE and add to RESULTS."
+    ;; ReplaceSpec =3D ModulePath [ Version ] "=3D>" FilePath newline
+    ;;             | ModulePath [ Version ] "=3D>" ModulePath Version newl=
ine .
+    (let* ((requirements (car results))
+           (replaced (cdr results))
+           (re (string-concatenate
+                '("([^[:blank:]]+)([[:blank:]]+([^[:blank:]]+))?"
+                  "[[:blank:]]+" "=3D>" "[[:blank:]]+"
+                  "([^[:blank:]]+)([[:blank:]]+([^[:blank:]]+))?")))
+           (match (string-match re line))
+           (module-path (match:substring match 1))
+           (version (match:substring match 3))
+           (new-module-path (match:substring match 4))
+           (new-version (match:substring match 6))
+           (new-replaced (acons module-path version replaced))
+           (new-requirements
+            (if (string-match "^\\.?\\./" new-module-path)
+                requirements
+                (acons new-module-path new-version requirements))))
+      (cons new-requirements new-replaced)))
+  (define (require-directive results line)
+    "Extract requirement from LINE and add it to RESULTS."
+    (let* ((requirements (car results))
+           (replaced (cdr results))
+           ;; A line in a require directive is composed of a module path a=
nd
+           ;; a version separated by whitespace and an optionnal '//' comm=
ent at
+           ;; the end.
+           (re (string-concatenate
+                '("^[[:blank:]]*"
+                  "([^[:blank:]]+)[[:blank:]]+([^[:blank:]]+)"
+                  "([[:blank:]]+//.*)?")))
+           (match (string-match re line))
+           (module-path (match:substring match 1))
+           (version (match:substring match 2)))
+      (cons (acons module-path version requirements) replaced)))
+  (with-input-from-port go.mod-port
+    (lambda ()
+      (let* ((results (toplevel '(() . ())))
+             (requirements (car results))
+             (replaced (cdr results)))
+        ;; At last we remove replaced modules from the requirements list
+        (fold
+         (lambda (replacedelem requirements)
+           (alist-delete! (car replacedelem) requirements))
+         requirements
+         replaced)))))
+
+(define (infer-module-root module-path)
+  "Go modules can be defined at any level of a repository's tree, but quer=
ying
+for the meta tag usually can only be done at the webpage at the root of th=
e
+repository. Therefore, it is sometimes necessary to try and derive a modul=
e's
+root path from its path. For a set of well-known forges, the pattern of wh=
at
+consists of a module's root page is known before hand."
+  ;; See the following URL for the official Go equivalent:
+  ;; https://github.com/golang/go/blob/846dce9d05f19a1f53465e62a304dea21b9=
9f910/src/cmd/go/internal/vcs/vcs.go#L1026-L1087
+  ;;
+  ;; TODO: handle module path with VCS qualifier as described in
+  ;; https://golang.org/ref/mod#vcs-find and
+  ;; https://golang.org/cmd/go/#hdr-Remote_import_paths
+  (define-record-type <vcs>
+    (make-vcs url-prefix root-regex type)
+    vcs?
+    (url-prefix vcs-url-prefix)
+    (root-regex vcs-root-regex)
+    (type vcs-type))
+  (let* ((known-vcs
+          (list
+           (make-vcs
+            "github.com"
+            "^(github\\.com/[A-Za-z0-9_.\\-]+/[A-Za-z0-9_.\\-]+)(/[A-Za-z0=
-9_.\\-]+)*$"
+            'git)
+           (make-vcs
+            "bitbucket.org"
+            "^(bitbucket\\.org/([A-Za-z0-9_.\\-]+/[A-Za-z0-9_.\\-]+))(/[A-=
Za-z0-9_.\\-]+)*$"
+            'unknown)
+           (make-vcs
+            "hub.jazz.net/git/"
+            "^(hub\\.jazz\\.net/git/[a-z0-9]+/[A-Za-z0-9_.\\-]+)(/[A-Za-z0=
-9_.\\-]+)*$"
+            'git)
+           (make-vcs
+            "git.apache.org"
+            "^(git\\.apache\\.org/[a-z0-9_.\\-]+\\.git)(/[A-Za-z0-9_.\\-]+=
)*$"
+            'git)
+           (make-vcs
+            "git.openstack.org"
+            "^(git\\.openstack\\.org/[A-Za-z0-9_.\\-]+/[A-Za-z0-9_.\\-]+)(=
\\.git)?(/[A-Za-z0-9_.\\-]+)*$"
+            'git)))
+         (vcs (find (lambda (vcs) (string-prefix? (vcs-url-prefix vcs) mod=
ule-path))
+                    known-vcs)))
+    (if vcs
+        (match:substring (string-match (vcs-root-regex vcs) module-path) 1=
)
+        module-path)))
+
+(define (go-module->guix-package-name module-path)
+  "Converts a module's path to the canonical Guix format for Go packages."
+  (string-downcase
+   (string-append "go-"
+                  (string-replace-substring
+                   (string-replace-substring
+                    module-path
+                    "." "-")
+                   "/" "-"))))
+
+(define-record-type <module-meta>
+  (make-module-meta import-prefix vcs repo-root)
+  module-meta?
+  (import-prefix module-meta-import-prefix)
+  ;; VCS field is a symbol
+  (vcs module-meta-vcs)
+  (repo-root module-meta-repo-root))
+
+(define (fetch-module-meta-data module-path)
+  "Fetches module meta-data from a module's landing page. This is
+  necessary because goproxy servers don't currently provide all the
+  information needed to build a package."
+  ;; <meta name=3D"go-import" content=3D"import-prefix vcs repo-root">
+  (define (meta-go-import->module-meta text)
+    "Takes the content of the go-import meta tag as TEXT and gives back
+     a MODULE-META record"
+    (define (get-component s start)
+      (let*
+          ((start (string-skip s char-set:whitespace start))
+           (end (string-index s char-set:whitespace start))
+           (end (if end end (string-length s)))
+           (result (substring s start end)))
+        (values result end)))
+    (let*-values (((import-prefix end) (get-component text 0))
+                  ((vcs end) (get-component text end))
+                  ((repo-root end) (get-component text end)))
+      (make-module-meta import-prefix (string->symbol vcs) repo-root)))
+  (define (html->meta-go-import port)
+    "Read PORT with HTML content. Find the go-import meta tag and gives
+    back its content as a string."
+    (let* ((parsedhtml (html->sxml port))
+           (extract-content (node-join
+                             (select-kids (node-typeof? 'html))
+                             (select-kids (node-typeof? 'head))
+                             (select-kids (node-typeof? 'meta))
+                             (select-kids (node-typeof? '@))
+                             (node-self
+                              (node-join
+                               (select-kids (node-typeof? 'name))
+                               (select-kids (node-equal? "go-import"))))
+                             (select-kids (node-typeof? 'content))
+                             (select-kids (lambda (_) #t))))
+           (content (car (extract-content parsedhtml))))
+      content))
+  (let* ((port (build-download:http-fetch (string->uri (format #f "https:/=
/~a?go-get=3D1" module-path))))
+         (meta-go-import (html->meta-go-import port))
+         (module-metadata (meta-go-import->module-meta meta-go-import)))
+    (close-port port)
+    module-metadata))
+
+(define (module-meta-data-repo-url meta-data goproxy-url)
+  "Return the URL where the fetcher which will be used can download the so=
urce
+control."
+  (if (member (module-meta-vcs meta-data)'(fossil mod))
+      goproxy-url
+      (module-meta-repo-root meta-data)))
+
+(define (source-uri vcs-type vcs-repo-url file)
+  "Generate the `origin' block of a package depending on what type of sour=
ce
+control system is being used."
+  (case vcs-type
+    ((git)
+     `(origin
+        (method git-fetch)
+        (uri (git-reference
+              (url ,vcs-repo-url)
+              (commit (string-append "v" version))))
+        (file-name (git-file-name name version))
+        (sha256
+         (base32
+          ,(guix-hash-url file)))))
+    ((hg)
+     `(origin
+        (method hg-fetch)
+        (uri (hg-reference
+              (url ,vcs-repo-url)
+              (changeset ,version)))
+        (file-name (format #f "~a-~a-checkout" name version))))
+    ((svn)
+     `(origin
+        (method svn-fetch)
+        (uri (svn-reference
+              (url ,vcs-repo-url)
+              (revision (string->number version))
+              (recursive? #f)))
+        (file-name (format #f "~a-~a-checkout" name version))
+        (sha256
+         (base32
+          ,(guix-hash-url file)))))
+    (else
+     (raise-exception (format #f "unsupported vcs type: ~a" vcs-type)))))
+
+(define* (go-module->guix-package module-path #:key (goproxy-url "https://=
proxy.golang.org"))
+  (call-with-temporary-output-file
+   (lambda (temp port)
+     (let* ((latest-version (fetch-latest-version goproxy-url module-path)=
)
+            (go.mod-path (fetch-go.mod goproxy-url module-path latest-vers=
ion
+                                       temp))
+            (dependencies (map car (parse-go.mod temp)))
+            (guix-name (go-module->guix-package-name module-path))
+            (root-module-path (infer-module-root module-path))
+            ;; VCS type and URL are not included in goproxy information. F=
or
+            ;; this we need to fetch it from the official module page.
+            (meta-data (fetch-module-meta-data root-module-path))
+            (vcs-type (module-meta-vcs meta-data))
+            (vcs-repo-url (module-meta-data-repo-url meta-data goproxy-url=
)))
+       (values
+        `(package
+           (name ,guix-name)
+           ;; Elide the "v" prefix Go uses
+           (version ,(string-trim latest-version #\v))
+           (source
+            ,(source-uri vcs-type vcs-repo-url temp))
+           (build-system go-build-system)
+           ,@(maybe-inputs (map go-module->guix-package-name dependencies)=
)
+           ;; TODO(katco): It would be nice to make an effort to fetch thi=
s
+           ;; from known forges, e.g. GitHub
+           (home-page ,(format #f "https://~a" root-module-path))
+           (synopsis "A Go package")
+           (description ,(format #f "~a is a Go package." guix-name))
+           (license #f))
+        dependencies)))))
+
+(define* (go-module-recursive-import package-name
+                                     #:key (goproxy-url "https://proxy.gol=
ang.org"))
+  (recursive-import
+   package-name
+   #:repo->guix-package (lambda* (name . _)
+                          (go-module->guix-package
+                           name
+                           #:goproxy-url goproxy-url))
+   #:guix-name go-module->guix-package-name))
diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm
index 0a3863f965..1d2b45d942 100644
--- a/guix/scripts/import.scm
+++ b/guix/scripts/import.scm
@@ -77,7 +77,7 @@ rather than \\n."
 ;;;
=20
 (define importers '("gnu" "nix" "pypi" "cpan" "hackage" "stackage" "elpa" =
"gem"
-                    "cran" "crate" "texlive" "json" "opam"))
+                    "go" "cran" "crate" "texlive" "json" "opam"))
=20
 (define (resolve-importer name)
   (let ((module (resolve-interface
diff --git a/guix/scripts/import/go.scm b/guix/scripts/import/go.scm
new file mode 100644
index 0000000000..fde7555973
--- /dev/null
+++ b/guix/scripts/import/go.scm
@@ -0,0 +1,118 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright =A9 2020 Katherine Cox-Buday <cox.katherine.e@HIDDEN>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix scripts import go)
+  #:use-module (guix ui)
+  #:use-module (guix utils)
+  #:use-module (guix scripts)
+  #:use-module (guix import go)
+  #:use-module (guix scripts import)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-11)
+  #:use-module (srfi srfi-37)
+  #:use-module (ice-9 match)
+  #:use-module (ice-9 format)
+  #:export (guix-import-go))
+
+
+;;;
+;;; Command-line options.
+;;;
+
+(define %default-options
+  '())
+
+(define (show-help)
+  (display (G_ "Usage: guix import go PACKAGE-PATH
+Import and convert the Go module for PACKAGE-PATH.\n"))
+  (display (G_ "
+  -h, --help             display this help and exit"))
+  (display (G_ "
+  -V, --version          display version information and exit"))
+  (display (G_ "
+  -r, --recursive        generate package expressions for all Go modules\
+ that are not yet in Guix"))
+  (display (G_ "
+  -p, --goproxy=3DGOPROXY  specify which goproxy server to use"))
+  (newline)
+  (show-bug-report-information))
+
+(define %options
+  ;; Specification of the command-line options.
+  (cons* (option '(#\h "help") #f #f
+                 (lambda args
+                   (show-help)
+                   (exit 0)))
+         (option '(#\V "version") #f #f
+                 (lambda args
+                   (show-version-and-exit "guix import go")))
+         (option '(#\r "recursive") #f #f
+                 (lambda (opt name arg result)
+                   (alist-cons 'recursive #t result)))
+         (option '(#\p "goproxy") #t #f
+                 (lambda (opt name arg result)
+                   (alist-cons 'goproxy
+                               (string->symbol arg)
+                               (alist-delete 'goproxy result))))
+         %standard-import-options))
+
+
+;;;
+;;; Entry point.
+;;;
+
+(define (guix-import-go . args)
+  (define (parse-options)
+    ;; Return the alist of option values.
+    (args-fold* args %options
+                (lambda (opt name arg result)
+                  (leave (G_ "~A: unrecognized option~%") name))
+                (lambda (arg result)
+                  (alist-cons 'argument arg result))
+                %default-options))
+
+  (let* ((opts (parse-options))
+         (args (filter-map (match-lambda
+                             (('argument . value)
+                              value)
+                             (_ #f))
+                           (reverse opts))))
+    (match args
+      ((module-name)
+       (if (assoc-ref opts 'recursive)
+           (map (match-lambda
+                  ((and ('package ('name name) . rest) pkg)
+                   `(define-public ,(string->symbol name)
+                      ,pkg))
+                  (_ #f))
+                (go-module-recursive-import module-name
+                                            #:goproxy-url
+                                            (or (assoc-ref opts 'goproxy)
+                                                "https://proxy.golang.org"=
)))
+           (let ((sexp (go-module->guix-package module-name
+                                                #:goproxy-url
+                                                (or (assoc-ref opts 'gopro=
xy)
+                                                    "https://proxy.golang.=
org"))))
+             (unless sexp
+               (leave (G_ "failed to download meta-data for module '~a'~%"=
)
+                      module-name))
+             sexp)))
+      (()
+       (leave (G_ "too few arguments~%")))
+      ((many ...)
+       (leave (G_ "too many arguments~%"))))))
diff --git a/tests/import-go.scm b/tests/import-go.scm
new file mode 100644
index 0000000000..7c59bf2d7c
--- /dev/null
+++ b/tests/import-go.scm
@@ -0,0 +1,143 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright =A9 2021 Fran=E7ois Joulaud <francois.joulaud@HIDDEN=
m>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Summary
+;; Tests for guix/import/go.scm
+
+(define-module (test-import-go)
+  #:use-module (guix import go)
+  #:use-module (guix base32)
+  ;#:use-module (guix tests)
+  #:use-module (ice-9 iconv)
+  #:use-module (ice-9 match)
+  #:use-module (srfi srfi-64))
+
+(define fixture-go-mod-simple
+  "module my/thing
+go 1.12
+require other/thing v1.0.2
+require new/thing/v2 v2.3.4
+exclude old/thing v1.2.3
+replace bad/thing v1.4.5 =3D> good/thing v1.4.5
+")
+
+(define fixture-go-mod-with-block
+  "module M
+
+require (
+         A v1
+         B v1.0.0
+         C v1.0.0
+         D v1.2.3
+         E dev
+)
+
+exclude D v1.2.3
+")
+
+
+(define fixture-go-mod-complete
+  "module M
+
+go 1.13
+
+replace github.com/myname/myproject/myapi =3D> ./api
+
+replace github.com/mymname/myproject/thissdk =3D> ../sdk
+
+replace launchpad.net/gocheck =3D> github.com/go-check/check v0.0.0-201402=
25173054-eb6ee6f84d0a
+
+require (
+	github.com/user/project v1.1.11
+	github.com/user/project/sub/directory v1.1.12
+	bitbucket.org/user/project v1.11.20
+	bitbucket.org/user/project/sub/directory v1.11.21
+	launchpad.net/project v1.1.13
+	launchpad.net/project/series v1.1.14
+	launchpad.net/project/series/sub/directory v1.1.15
+	launchpad.net/~user/project/branch v1.1.16
+	launchpad.net/~user/project/branch/sub/directory v1.1.17
+	hub.jazz.net/git/user/project v1.1.18
+	hub.jazz.net/git/user/project/sub/directory v1.1.19
+	k8s.io/kubernetes/subproject v1.1.101
+	one.example.com/abitrary/repo v1.1.111
+	two.example.com/abitrary/repo v0.0.2
+)
+
+replace two.example.com/abitrary/repo =3D> github.com/corp/arbitrary-repo =
v0.0.2
+
+replace (
+	golang.org/x/sys =3D> golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a=
 // pinned to release-branch.go1.13
+	golang.org/x/tools =3D> golang.org/x/tools v0.0.0-20190821162956-65e3620a=
7ae7 // pinned to release-branch.go1.13
+)
+
+")
+
+(test-begin "import go")
+
+(test-equal "go-path-escape"
+  "github.com/!azure/!avere"
+  ((@@ (guix import go) go-path-escape) "github.com/Azure/Avere"))
+
+
+
+;; We define a function for all similar tests with different go.mod files
+(define (testing-parse-mod name expected input)
+ (define (inf? p1 p2)
+    (string<? (car p1) (car p2)))
+ (let ((input-port (open-input-string input)))
+   (test-equal name
+               (sort expected inf?)
+               (sort
+                  ( (@@ (guix import go) parse-go.mod-port)
+                    input-port)
+                  inf?))))
+
+(testing-parse-mod "parse-go.mod-simple"
+            '(("good/thing" . "v1.4.5")
+              ("new/thing/v2" . "v2.3.4")
+              ("other/thing" . "v1.0.2"))
+            fixture-go-mod-simple)
+
+(testing-parse-mod "parse-go.mod-with-block"
+                  '(("A" . "v1")
+                    ("B" . "v1.0.0")
+                    ("C" . "v1.0.0")
+                    ("D" . "v1.2.3")
+                    ("E" . "dev"))
+                   fixture-go-mod-with-block)
+
+(testing-parse-mod "parse-go.mod-complete"
+                  '(("github.com/corp/arbitrary-repo" . "v0.0.2")
+                    ("one.example.com/abitrary/repo" . "v1.1.111")
+                    ("hub.jazz.net/git/user/project/sub/directory" . "v1.1=
.19")
+                    ("hub.jazz.net/git/user/project" . "v1.1.18")
+                    ("launchpad.net/~user/project/branch/sub/directory" . =
"v1.1.17")
+                    ("launchpad.net/~user/project/branch" . "v1.1.16")
+                    ("launchpad.net/project/series/sub/directory" . "v1.1.=
15")
+                    ("launchpad.net/project/series" . "v1.1.14")
+                    ("launchpad.net/project" . "v1.1.13")
+                    ("bitbucket.org/user/project/sub/directory" . "v1.11.2=
1")
+                    ("bitbucket.org/user/project" . "v1.11.20")
+                    ("k8s.io/kubernetes/subproject" . "v1.1.101")
+                    ("github.com/user/project/sub/directory" . "v1.1.12")
+                    ("github.com/user/project" . "v1.1.11")
+                    ("github.com/go-check/check" . "v0.0.0-20140225173054-=
eb6ee6f84d0a"))
+                   fixture-go-mod-complete)
+
+(test-end "import go")
--=20
2.30.0=




Information forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.

Message received at 44178 <at> debbugs.gnu.org:


Received: (at 44178) by debbugs.gnu.org; 29 Jan 2021 16:43:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 29 11:43:11 2021
Received: from localhost ([127.0.0.1]:52845 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l5WrW-0000oy-CU
	for submit <at> debbugs.gnu.org; Fri, 29 Jan 2021 11:43:11 -0500
Received: from mx07-00115501.pphosted.com ([185.132.182.48]:18314
 helo=mx08-00115501.pphosted.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <prvs=9663a57d84=francois.joulaud@HIDDEN>)
 id 1l5WrR-0000om-9o
 for 44178 <at> debbugs.gnu.org; Fri, 29 Jan 2021 11:43:08 -0500
Received: from pps.filterd (m0001541.ppops.net [127.0.0.1])
 by mx07-00115501.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id
 10TGVWCx008897; Fri, 29 Jan 2021 17:43:03 +0100
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=radiofrance.com;
 h=from : to : cc :
 subject : date : message-id : references : in-reply-to : content-type :
 content-id : content-transfer-encoding : mime-version;
 s=radiofrance20190306; bh=CM5WxL5vRmqPsxYJQdP18+gwq09zAkNhOwrmSjqF/gQ=;
 b=f1kqd0hKQJfGiS/1BaBAZwwbW5HHkSS5Kw9g/TTS+AkuBH3PET6d58h8uk6zcDidTWTe
 xyg4W1TYt9+y2dAbS0MH03mrcZoe3aqwqTv5IMpA3n14XqwCzVppKZ7bMRS4Y/qNy6Mq
 ycu5WC1Djq1gYtRSVNtrnIPbql8UDwvfwJqO0MyHAcVzaTJ8gUIf9nWnuFH3QRymC4yI
 y4cvyYkpStbeMxpi1fUPk1wSNZIFiPdl0ze+I7J4kzSyuZ16V6FmHTdLKgVBlPu/j8Ty
 b5mEMwWRAMWYatVoaXo+Y5ycmhm6uI3bTQslWcHsHRwOvBTxAzlDveOG0Li3mb4rLM/T zg== 
Received: from fra01-mr2-obe.outbound.protection.outlook.com
 (mail-mr2fra01lp0102.outbound.protection.outlook.com [104.47.25.102])
 by mx07-00115501.pphosted.com with ESMTP id 3688x9avma-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
 Fri, 29 Jan 2021 17:43:03 +0100
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=Bv3yS8VWPlPUuzSdqW7OQpm8jk6ZYmsqgv1Qp8U7t1SL0zvm7cmkGm6iI/Yujxix7Q4RygMMD25nl42kw/ttvZZp7y111W1OH6G/44gFxsVygKodbJtvWXyJRREKTKhLqi6jqqWC/3xzoA48DNoMbUo8H5WEgfoKctRj51SxTL3UvKt5Bou655caltOecWhmjIlF3UFI//D7vjgGfQiP7gOlWc16XurAb4N4Cy7IBDhCpd0r6QdCBaIugGASZYlaALrUb7wXjWSNI78qiBUL+OOFHPWGPL+OF2O+xgnH3vXR5TioW9r88AUY2iGGjiHa2ejPr6PNy+ouNDK0bz4vFw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=CM5WxL5vRmqPsxYJQdP18+gwq09zAkNhOwrmSjqF/gQ=;
 b=M+GeyaG5IzHhNa8rpEDM1JFE4rOUIX/AGKJFd0ImFTYPEzz2ICJl9tPQcCa2vriah0Hh1h/AJ5DmtaZV+MkXgpxIUymZVJDfBAsz7XY3XKZsV2m+uwzGad2+rmjnqzQfqjpP0xx0r+LFc8tjrZFtdvC346oAUX/RJpl9cSXbTpSyj5rqrHsNf2fXZSB9CvJDUKXOhyXYlIlX6EtvaeTNpC56LhPdgStZZHa1VXULPKpfbMMIpCIp5Et47Y77mOB1XrYvVvo8FaPV2D2K7BQ6pc3nmVDysbrhGaxRYPlGrVTJmHb0V+8N5zL79YulaDXHHt7dlJ9Yt7Zh6Rw9ITKaoA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=radiofrance.com; dmarc=pass action=none
 header.from=radiofrance.com; dkim=pass header.d=radiofrance.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=RFonline.onmicrosoft.com; s=selector2-RFonline-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=CM5WxL5vRmqPsxYJQdP18+gwq09zAkNhOwrmSjqF/gQ=;
 b=pZNpCMtr1Uft8tNFSWxP5rm70CuxhV0/mwflCzXhhqZYOyznagVle4J1uU+rua6PoSvcbxSvU8k/LziKj2se/evTYZqCgEIs98lhr6JbzJnQ4KVgGbvYHZb0scV1HUKCRJWmQ1N+p5Py1AVCqlLlTJIMJTfMj2oJiZNAKlPILJw=
Received: from PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:b::20) by
 PR0P264MB0987.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:147::13) with
 Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.3784.16; Fri, 29 Jan 2021 16:43:02 +0000
Received: from PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM
 ([fe80::51bc:289d:ff1a:6b58]) by PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM
 ([fe80::51bc:289d:ff1a:6b58%6]) with mapi id 15.20.3784.017; Fri, 29 Jan 2021
 16:43:02 +0000
From: =?utf-8?B?Sk9VTEFVRCBGcmFuw6dvaXM=?= <Francois.JOULAUD@HIDDEN>
To: =?utf-8?B?THVkb3ZpYyBDb3VydMOocw==?= <ludo@HIDDEN>,
 "44178 <at> debbugs.gnu.org" <44178 <at> debbugs.gnu.org>
Subject: Re: [PATCH] Create importer for Go modules
Thread-Topic: [PATCH] Create importer for Go modules
Thread-Index: AQHW8c+fh3EThKxKn0aE+FBPMWbUYao1zif4gAMIIACAArpljIABfodkgAHH4YA=
Date: Fri, 29 Jan 2021 16:43:02 +0000
Message-ID: <20210129163945.irrdlm3updejkcsg@HIDDEN>
References: <20210123212742.m2thdeuzdvgpkgeo@HIDDEN>
 <87r1mb6zu9.fsf@HIDDEN>
 <20210125205910.qvmcusm5w5n4pawy@HIDDEN>
 <87sg6mmolg.fsf@HIDDEN> <87czxpp4wy.fsf@HIDDEN>
In-Reply-To: <87czxpp4wy.fsf@HIDDEN>
Accept-Language: fr-FR, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
authentication-results: gnu.org; dkim=none (message not signed)
 header.d=none;gnu.org; dmarc=none action=none header.from=radiofrance.com;
x-originating-ip: [88.126.13.52]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 40136abd-68fd-4539-fb35-08d8c474f1e0
x-ms-traffictypediagnostic: PR0P264MB0987:
x-ms-exchange-transport-forked: True
x-microsoft-antispam-prvs: <PR0P264MB0987AEA1088BBA2C35C517BA96B99@HIDDEN>
x-ms-oob-tlc-oobclassifiers: OLM:10000;
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: El/TLmO+r8QYa7V/t4VtWw9yPL3Wegx1nmbi8yuXpbIHh+t25i6hZMUYNwDKACw024AqQVaoem8pgrdT+1pNEuT7dNGY5eXzwmfGY/M/13lNXs5zcBtqPXqh18Cn1wDgw7SGY7ylJCTpO/tocQpY7zsoMR/cAKM6M30/UU9Wnef6Zr/5E0TCbEftvKxIWjVz+uTtWQk9Fpx4S/2z84EyvnOaJ0cmUxfqW5A7Zj+tKRnddns3MzqL5OHs9kdkfLSAtaf45fptazttxrTBceagqoA6oMFPrs+/DxRWoUjQpEO9AxllzoBjIuLlpKdPxfukjHchMveZzfjU0008z3RqLSpGXe6HRHeCsnbRi6smxHGLS4JIARm8AHxGabKM/BeJZOoCsuJ/DK2Z5M9RwFHi8jV7tDRtRODzVvShlZta7X+eIb+XUdo18iheajgs+wR/iXcd8SNmo+F2KyVvkILp4ck0TphytI3k6LS1D0glvMTFAH3r5mrpgKVos4QOsssK+gi5lEa/HfvqjzN17QXnqDyXTv9HSGHs00bCaQGeSX1Fi9eS9J7cPg9EK41upjDtk1185BiSpShokUIU7a/wDtb8ZQv4l3K0A/9LRK/KImo=
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM; PTR:; CAT:NONE;
 SFS:(4636009)(366004)(136003)(396003)(39860400002)(346002)(376002)(110136005)(6512007)(966005)(8936002)(83380400001)(316002)(76116006)(8676002)(66946007)(66556008)(85202003)(64756008)(85182001)(66446008)(86362001)(2906002)(186003)(4326008)(1076003)(5660300002)(6486002)(66476007)(66574015)(478600001)(26005)(4744005)(71200400001)(6506007)(9686003);
 DIR:OUT; SFP:1101; 
x-ms-exchange-antispam-messagedata: =?utf-8?B?dWkxL0xCNlpFOCsvQVNLTmR6d2ZYZ1BoOUdCRUw3VnVUU01qSVJ5dmVEK1ZC?=
 =?utf-8?B?Wk5ZbHluYWFraS9FREdaR211eXhQRzYwcDhUdHUrcFIyeWpieGNXV25tUTFN?=
 =?utf-8?B?M0NENWZuS21pc0I4OUF2NUQzS2FZczFCaXMzbzJWWUw5YngwNnlsZ211ckFH?=
 =?utf-8?B?T3FIckVGOG5SbnRlaktUWW84cHk1cEJIRnBURng0YTZxRVZrc2kwdDJPUHJz?=
 =?utf-8?B?N0NjV1pzRVpCWGIxZysvMEkvRkttbmtjcTBpZWZnYUxYaVFTVDEvNUxzaFZ1?=
 =?utf-8?B?QXNVUjk1Q0d2TFJWd1dvdkFEenhDK3hEVzBkeURGN0xTa1ZjZ0JBTnkyaElZ?=
 =?utf-8?B?QzVUWXdjTjZRTHpsTVAyYWlBMVVJay9haFFoNWF5ZWhjSmVVTXlkSHpZMmJk?=
 =?utf-8?B?c3JaYUYrUnM4Y3BndW83ZUxSRzM5WlNCeVJKTEpHRVNGM2g0Y1ozY3h5Nkls?=
 =?utf-8?B?dWxidUJpUHVYbVQzUWw3cmtpd2NHeGpsVTFhTEJqbGVHZlRBUkZwcGJnbFdM?=
 =?utf-8?B?UkY3Qys0UmRRcnlxcmtDcjJKUi9JQThlQ1ZRQTV4Vmd3aGlJVmo1QzAxV0hR?=
 =?utf-8?B?YnR6MmFiaU9ObU8vU2l5Nk5ML1Joc0dKeFQrV2dkNDY1YmNObGhWaGxmV0lk?=
 =?utf-8?B?amhoc2ZtUGEvNHpWaWNVNk5rcFBCY0tiUmg5Tlc4MXdSVENyK2xuckJIQnRh?=
 =?utf-8?B?bDJKSk5oUmduZHZMWlhXS1Qwa2VTYWRoRDdCSXFMN2VxTk9RRWJyNHZyYURO?=
 =?utf-8?B?WW42VnBudGZ6UCszcjhoUnF4aEg2bnRvWFlMWU8vMGNEK1Jsem9Pc3Jka0sx?=
 =?utf-8?B?WUdESndWWTlRYVBXbkExdFk5dmVrZEFkVG42ZzVONm5ROG02azdVWk43UUpo?=
 =?utf-8?B?MUxQa1JZNnA0RXpUK1dIcENaRzMrWWQrT0lUMzJRTVRSTENyZGJpeTBzRFlq?=
 =?utf-8?B?TVZhbUs0REtxR291Njc3STMrWE9xMU0yWmlMaDAyWlFvSURuK3NDZWF6eVRw?=
 =?utf-8?B?SVAvSXFlamlaNHUyWHVLMm4xUC9XUlhLQ3doRGxwbERrUDczNlNoU0ViTDdV?=
 =?utf-8?B?bUMzWnk3NHJ6OERKL2FVQ1ZrSVR2Yi9kNW5XaUZjelR3MmMwREwvWE8xS1ZI?=
 =?utf-8?B?OTFyZWtWODJWZy91b1dwK2s5VHdMNjVyVVgzYWVnRklhMk1MMEw4bm0reW9x?=
 =?utf-8?B?MTdJUXhlWWJnOTV4cTlWNGtXZ2dOUWlEZ3RYbmpVR1VaY0FjZ0lTSkF0UGI2?=
 =?utf-8?B?cmxGMzRTR05SN0JYdVhpczJ2dSszdDdrN05QUnJkSTRiSEQrYisrcDNEV1Q4?=
 =?utf-8?B?eXNtaUwzVkJrZVNUVkZ4UTdqeGdKdmZ2ZjM2a1JITzEwOVFEREVrVExHcTl2?=
 =?utf-8?B?bExUYjBnWUpXUG43Y0Q0dzBnSSswb0krdDlySUJRTnlzdi84UFRZekhrQVdG?=
 =?utf-8?Q?VL60baww?=
Content-Type: text/plain; charset="utf-8"
Content-ID: <CC7ECFFD5629EB4BBBD1AC971413D7DF@HIDDEN>
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-OriginatorOrg: radiofrance.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-Network-Message-Id: 40136abd-68fd-4539-fb35-08d8c474f1e0
X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jan 2021 16:43:02.5139 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 1d643b07-8cf5-4e2d-ad1e-86d6b948fc3b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: RQQQZO2WisWQmYiP8knXr+TDQ1qRZTmCBepfG++RK73bDsaNRUlvhp8cDh1rPnZxU/9Fb0lw3oEPZQz/voeP4g/0bS9wxQERCoBEWs47DWgSRWtGklavEbXqYsfmtqly
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR0P264MB0987
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.737
 definitions=2021-01-29_06:2021-01-29,
 2021-01-29 signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0
 phishscore=0
 clxscore=1015 bulkscore=0 impostorscore=0 adultscore=0 priorityscore=1501
 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 spamscore=0 mlxscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000
 definitions=main-2101290081
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 44178
Cc: Katherine Cox-Buday <cox.katherine.e@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

SGVsbG8hDQoNCk9uIFRodSwgSmFuIDI4LCAyMDIxIGF0IDAyOjI3OjU3UE0gKzAxMDAsIEx1ZG92
aWMgQ291cnTDqHMgd3JvdGU6DQo+IEkgdGhpbmsgd2hvZXZlciBhbW9uZyB5b3UgaXMgYXZhaWxh
YmxlIHRvIHdvcmsgb24gaXQgdGhlc2UgZGF5cyBjb3VsZA0KPiB0YWtlIHRoZSBsZWFkIGFuZCBw
cmVwYXJlIGEgZmluYWwgdmVyc2lvbiBvZiB0aGUgcGF0Y2hlcy4gIEl0IGxvb2tzIGxpa2UNCj4g
aXTigJlzIGFwcHJvYWNoaW5nIGEgZmlyc3Qg4oCcY29tbWl0dGFibGXigJ0gdmVyc2lvbiAocGVy
aGFwcyBqdXN0IG1pc3NpbmcgYW4NCj4gYWRkaXRpb24gdG8gZG9jL2d1aXgudGV4aSBhbmQgdGVz
dCBjYXNlcyBsaWtlIHdlIGhhdmUg4oCYdGVzdHMvY3Bhbi5zY23igJkgJg0KPiBjby4pDQoNCkkg
dGhvdWdodCBJIHdvdWxkIGJlIGFibGUgdG8gc2VuZCBhIHdvcmtpbmcgdjIgb2YgdGhpcyBwYXRj
aCB0b2RheSBidXQNCml0IHNlZW1zIEkgd2FzIHRvbyBvcHRpbWlzdGljLg0KDQpJIGZvdW5kIHRo
YXQgc29tZSBnby5tb2Qgb3V0IHRoZXJlIHVzZXMgcXVvdGVkIHN0cmluZw0Kd2hpY2ggb3VyIGFk
LWhvYyBwYXJzZXIgZG9uJ3Qga25vdyBob3cgdG8gcGFyc2UuIGNmLg0KaHR0cHM6Ly9naXRodWIu
Y29tL2dvLXlhbWwveWFtbC9ibG9iLzQ5NjU0NWE2MzA3YjJhN2Q3YTcxMGZkNTE2ZTVlMTZlOGFi
NjJkYmMvZ28ubW9kDQoNCkkgZG9uJ3Qga25vdyBpZiB0aGlzIGlzIGEgYmxvY2tlciBmb3IgYSBt
ZXJnZSBvciBub3QuDQoNCkFwYXJ0IGZyb20gdGhhdCBJIGRvbid0IGtub3cgaG93IHRvIGFkZCBn
dWlsZS1saWIgdG8gdGhlIGRlcGVuZGVuY2llcyBvZg0KR3VpeCAoaW4gb3JkZXIgdG8gdXNlIGh0
bWxwcmFnKS4gSGVscCBuZWVkZWQuDQoNCkkgdGVzdGVkIGl0IHJlY3Vyc2l2ZWx5IHdpdGggZ2l0
aHViLmNvbS9oYXNoaWNvcnAvY29uc3VsICh3aGljaCB3YXMgb25lDQpvZiB0aG9zZSB3aXRoIHRo
ZSBtb3N0IGRlcGVuZGVuY2llcyBJIGZvdW5kKSBhbmQgaXQgbW9zdGx5IHdvcmtzLg0KDQpSZWdh
cmRzLA0KRnJhbsOnb2lz




Information forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.

Message received at 44178 <at> debbugs.gnu.org:


Received: (at 44178) by debbugs.gnu.org; 28 Jan 2021 16:03:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 28 11:03:36 2021
Received: from localhost ([127.0.0.1]:49596 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l59lg-000314-45
	for submit <at> debbugs.gnu.org; Thu, 28 Jan 2021 11:03:36 -0500
Received: from eggs.gnu.org ([209.51.188.92]:34106)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1l59le-00030n-Ga
 for 44178 <at> debbugs.gnu.org; Thu, 28 Jan 2021 11:03:34 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:45200)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1l59lY-0004ay-Nv; Thu, 28 Jan 2021 11:03:28 -0500
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=58482 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1l59lV-00025w-Ql; Thu, 28 Jan 2021 11:03:26 -0500
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: adfeno--- via <help-guix@HIDDEN>
Subject: Re: packaging a golang package
References: <87h7nrud2a.fsf@HIDDEN>
 <4bdbc469-ad45-4739-b001-739ad3a60adc@HIDDEN>
 <87a6thtyvm.fsf@HIDDEN> <87bldw0ztb.fsf@HIDDEN>
 <CANe01w6HZv4=n4HmfdtZECb78wT5SDA8PafbKmntgqDwav-yWA@HIDDEN>
 <20210125204534.ovhvt7rzj7tbqrnt@HIDDEN>
 <87wnvymoxe.fsf@HIDDEN>
 <bf7bc90e-17b0-7393-ce02-b38a12d0ab48@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 9 =?utf-8?Q?Pluvi=C3=B4se?= an 229 de la =?utf-8?Q?R?=
 =?utf-8?Q?=C3=A9volution?=
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Thu, 28 Jan 2021 17:03:22 +0100
In-Reply-To: <bf7bc90e-17b0-7393-ce02-b38a12d0ab48@HIDDEN> (adfeno's
 message of "Thu, 28 Jan 2021 07:32:18 -0300")
Message-ID: <87mtwtkq0l.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 44178
Cc: guix-devel@HIDDEN, 44178 <at> debbugs.gnu.org,
 Adonay Felipe Nogueira <adfeno@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

adfeno--- via <help-guix@HIDDEN> skribis:

> If by vendoring we mean bundling and also make users fetch data from plac=
es not explicitly committed to the GNU FSDG, then allow me to jump in to ad=
d some important notes.
>
> Em 27/01/2021 11:31, Katherine Cox-Buday escreveu:
>> As a packager for a distribution, I dislike vendoring because of the
>> reasons you outlined above, _but_ I also dislike building upstream
>> software with versions of dependencies that weren't approved, tested,
>> and verified, upstream. It seems to me like that's a recipe for
>> unstable, maybe even insecure, software.
>
> I also agree that this would be problematic, but I fear that if we surren=
der to vendoring, we might defeat the purpose of GNU Guix.

I sympathize with that feeling.

It=E2=80=99s definitely a hard problem.  Even Debian, which has been a
lighthouse for many on these matters, recently gave up:

  https://lwn.net/Articles/843313/

I think both Katherine=E2=80=99s concerns and yours are valid.

IMO, the importer should be able to import things recursively and assume
we=E2=80=99re not going to bundle anything.  It=E2=80=99d be up to the pack=
ager, then,
to opt out and selectively use bundled copies of dependencies, if and
when that appears necessary.

> I'm OK with the importer approach but, *in my opinion*, I don't think thi=
s tackles the true issue described on the 4th paragraph of the =E2=80=9CLic=
ense Rules=E2=80=9D described on the GNU FSDG ([1]), this is why I opened G=
uix bug #45450 ([2]).

IMO, =E2=80=98guix import=E2=80=99 does not =E2=80=9Csteer users towards ob=
taining any nonfree
information=E2=80=9D any more than wget does.  It=E2=80=99s a tool for pack=
agers that
returns a package definition or template thereof, and it=E2=80=99s up to the
packager to decide what to do with it.

Thanks,
Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.

Message received at 44178 <at> debbugs.gnu.org:


Received: (at 44178) by debbugs.gnu.org; 28 Jan 2021 13:28:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 28 08:28:08 2021
Received: from localhost ([127.0.0.1]:47593 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l57LE-0006se-ID
	for submit <at> debbugs.gnu.org; Thu, 28 Jan 2021 08:28:08 -0500
Received: from eggs.gnu.org ([209.51.188.92]:35570)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1l57LC-0006s9-8a
 for 44178 <at> debbugs.gnu.org; Thu, 28 Jan 2021 08:28:07 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:41875)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1l57L6-000802-AS; Thu, 28 Jan 2021 08:28:00 -0500
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=58086 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1l57L5-0007hx-3u; Thu, 28 Jan 2021 08:27:59 -0500
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Katherine Cox-Buday <cox.katherine.e@HIDDEN>
Subject: Re: [PATCH] Create importer for Go modules
References: <20210123212742.m2thdeuzdvgpkgeo@HIDDEN>
 <87r1mb6zu9.fsf@HIDDEN>
 <20210125205910.qvmcusm5w5n4pawy@HIDDEN>
 <87sg6mmolg.fsf@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 9 =?utf-8?Q?Pluvi=C3=B4se?= an 229 de la =?utf-8?Q?R?=
 =?utf-8?Q?=C3=A9volution?=
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Thu, 28 Jan 2021 14:27:57 +0100
In-Reply-To: <87sg6mmolg.fsf@HIDDEN> (Katherine Cox-Buday's message of
 "Wed, 27 Jan 2021 08:38:51 -0600")
Message-ID: <87czxpp4wy.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 44178
Cc: Helio Machado <0x2b3bfa0@HIDDEN>,
 "44178 <at> debbugs.gnu.org" <44178 <at> debbugs.gnu.org>,
 JOULAUD =?utf-8?Q?Fran=C3=A7ois?= <Francois.JOULAUD@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hello!

Katherine Cox-Buday <cox.katherine.e@HIDDEN> skribis:

> - The conversation about this seems to be happening in 3 different
>   places: here, help-guix, and guix-devel. I guess we should be
>   centralizing here.

+1

> - I don't have any experience coordinating with people in this
>   email-style forge. I don't know how the inter-diff patches work with
>   attribution, nor how to get everyone on the same page. It seems like
>   multiple people are making conflicting changes at once (maybe that's
>   just my perception).

I think whoever among you is available to work on it these days could
take the lead and prepare a final version of the patches.  It looks like
it=E2=80=99s approaching a first =E2=80=9Ccommittable=E2=80=9D version (per=
haps just missing an
addition to doc/guix.texi and test cases like we have =E2=80=98tests/cpan.s=
cm=E2=80=99 &
co.)

For attribution, I=E2=80=99d keep Katherine as the commit author and add a
=E2=80=98Co-authored-by=E2=80=99 line for Fran=C3=A7ois and for Helio (that=
=E2=80=99s how we usually
handle that given that Git assumes each commit has a single author).

When that first version is committed, you can all submit patches for
improvements.  For now, the focus should be on getting the first version
in.  :-)

My 2=C2=A2,
Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.

Message received at 44178 <at> debbugs.gnu.org:


Received: (at 44178) by debbugs.gnu.org; 28 Jan 2021 10:25:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 28 05:25:29 2021
Received: from localhost ([127.0.0.1]:47324 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l54UR-0006Pe-Q4
	for submit <at> debbugs.gnu.org; Thu, 28 Jan 2021 05:25:28 -0500
Received: from smtp-out-4.mxes.net ([198.205.123.69]:23688)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail+G7=8ddd25ee@HIDDEN>)
 id 1l52Vk-0005JF-77
 for 44178 <at> debbugs.gnu.org; Thu, 28 Jan 2021 03:18:40 -0500
Received: from Customer-MUA (mua.mxes.net [IPv6:fd::1])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by smtp.mxes.net (Postfix) with ESMTPSA id 4CEA97597A;
 Thu, 28 Jan 2021 03:18:33 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mxes.net; s=mta;
 t=1611821914; bh=mHV9Pyfs/DRlNaJpz13c+Cj/M+HxQrKEYFzNhSiqRo4=;
 h=From:To:Subject:In-Reply-To:References:Date:Message-ID:
 MIME-Version:Content-Type;
 b=mI1KpcXvKaqaj3WvKKR9qQb31o1qhGL2VCMRVjC42V9O5de2faF+eTck/IjcC31Vc
 k2O8jmqaRB7oCZfzmUuGdNSeTvYf/3irQQ/u5tor1vgELI1xX4PrCjTl5gQV+8in0f
 XL7bw47KJ9cUNKCOjZW1lep1vkVj/iAHSZcpfKvo=
From: Timmy Douglas <mail@HIDDEN>
To: Katherine Cox-Buday <cox.katherine.e@HIDDEN>, 44178 <at> debbugs.gnu.org,
 JOULAUD =?utf-8?Q?Fran=C3=A7ois?= <Francois.JOULAUD@HIDDEN>
Subject: Re: packaging a golang package
In-Reply-To: <87wnvymoxe.fsf@HIDDEN>
References: <87h7nrud2a.fsf@HIDDEN>
 <4bdbc469-ad45-4739-b001-739ad3a60adc@HIDDEN>
 <87a6thtyvm.fsf@HIDDEN> <87bldw0ztb.fsf@HIDDEN>
 <CANe01w6HZv4=n4HmfdtZECb78wT5SDA8PafbKmntgqDwav-yWA@HIDDEN>
 <20210125204534.ovhvt7rzj7tbqrnt@HIDDEN>
 <87wnvymoxe.fsf@HIDDEN>
Date: Thu, 28 Jan 2021 00:18:31 -0800
Message-ID: <87ft2l4gq0.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Sent-To: <NDQxNzhAZGViYnVncy5nbnUub3Jn>
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 44178
X-Mailman-Approved-At: Thu, 28 Jan 2021 05:25:26 -0500
Cc: guix-devel@HIDDEN, "help-guix@HIDDEN" <help-guix@HIDDEN>,
 Helio Machado <0x2b3bfa0@HIDDEN>, Leo Famulari <leo@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Katherine Cox-Buday <cox.katherine.e@HIDDEN> writes:

> Hello again, Fran=C3=A7ois! I've redirected this thread to guix-devel, and
> the bug since we've begun discussing implementation details.
>
> JOULAUD Fran=C3=A7ois <Francois.JOULAUD@HIDDEN> writes:
>
>> First is to use vendored dependencies (when upstream provides them). This
>> one has the merits of simplicity (as we just have to download the
>> source and launch `go build` or whatever is needed) and less risks of
>> bugs. The downsides are known: difficult to audit Licences, duplication
>> of code source, difficulty to follow security bugs, etc.
>
> -1 to this approach (explanation below).

Seems like there could be two sub-scenarios here: the code could use go
modules or not.

>> Second is to re-vendor package from go.mod (coming directly from code
>> source or synthetized from source) by creating a source derivation
>> including all dependencies. This is the strategy followed by Nixpkgs
>> as explained in [1]. (It seems to me this is the route followed in
>> the patches to  from Helio in [2] but I did not take the time to read
>> them.) With this approach we still have some of the downsides of using
>> vendored upstream but it is at least easier to verify the existence
>> of upstream.
>
> I don't fully understand this approach, so I don't understand how this
> is different to approach three? Does this mean we create a pseudo,
> non-public package which states all the dependencies as inputs? If so,
> why wouldn't we just go with option three?

I think this approach is like saying you git clone the upstream repo,
run go mod vendor or go mod download, then go build. Or whatever
buildGoModule does in nix (https://github.com/NixOS/nixpkgs/issues/84826)

I read through that issue and would personally vote for this approach of
using `go` to restore the code.

I think trying to reimplement go module restore process with Guix
packages is bordering on Not Invented Here. There would be a never
ending battle of trying to reimplement the go module restore process and
the amount of source packages would really clutter things up. I think
some of the issues with the distro wanting to change a package could be
solved with a feature to patch go.mod before calling `go` to restore.

>> Third is to package every dependencies. This is the most transparent way
>> and the one that leads to less code duplication but the downside is the
>> difficulty to scale with the number of packages (even if the objective of
>> patch at [3] is to automate it) and the need to have only one reference
>> version for each package in the distribution which have its own share of
>> problems (one of them being that we don't use those tested by upstream
>> as stated in [4]).
>
> I think this is the eternal conflict between distributions and
> code-bases. As a software engineer, I am a fan of vendoring. It removes
> entire classes of issues:
>
> - Dependency on remote servers to be up to fetch dependencies and
>   perform builds
> - Requiring some kind of system to pin versions
> - Needing to stay on top of releases even if that doesn't meet your
>   schedule or needs
>
> As a packager for a distribution, I dislike vendoring because of the
> reasons you outlined above, _but_ I also dislike building upstream
> software with versions of dependencies that weren't approved, tested,
> and verified, upstream. It seems to me like that's a recipe for
> unstable, maybe even insecure, software.
>
> Normally, distributions are forced to do this because their packaging
> and build systems are only set up to support one version at a time. Guix
> can theoretically support all versions, but doesn't want to take on the
> dependency graph explosion this approach would cause.
>
> If we go on historical precedent, and how Guix handles the other
> language ecosystems, we should only have one version of each dependency,
> and build all software which relies on that dependency on the version we
> have packaged. Guix has already begun taking on the difficult challenges
> with this approach, including patching upstream to work with versions of
> dependencies upstream was not built for.

That sounds like a pretty difficult challenge. Seems like it could
quickly become untenable if a commonly used library had some sort of
breaking change between versions and different versions of it were used
by different packages.

I don't think anything is stopping Guix from having multiple versions,
but hand-assigning them would feel pretty manual and error-prone. On the
other hand, like you said, the dependency graph explosion from importing
everything would be overwhelming.

> I dislike it, but I also don't think we should try to solve the broader
> class of issues while trying to implement an importer. It should be a
> larger discussion within the Guix community across _all_ language
> packages about how we might achieve upstream parity while still
> maintaining our goals as a distribution, all while not crippling our
> infrastructure and people :)
>
> That's my viewpoint, but I think we should all defer to some of the
> longer-term maintainers who have helped guide Guix.

You wrote up both sides pretty well, but I couldn't tell if you had a
strong opinion on having go restore dependencies vs Guix packaging
dependencies. You had a lot of strong points for vendoring, but you're
writing an importer...

> Thanks for writing up these options.

+1




Information forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.

Message received at 44178 <at> debbugs.gnu.org:


Received: (at 44178) by debbugs.gnu.org; 28 Jan 2021 08:16:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 28 03:16:04 2021
Received: from localhost ([127.0.0.1]:47090 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l52TC-0005Ek-CV
	for submit <at> debbugs.gnu.org; Thu, 28 Jan 2021 03:16:04 -0500
Received: from smtp-out-4.mxes.net ([198.205.123.69]:60022)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail+G7=8ddd25ee@HIDDEN>)
 id 1l4zQf-0002Jd-Sq
 for 44178 <at> debbugs.gnu.org; Thu, 28 Jan 2021 00:01:14 -0500
Received: from Customer-MUA (mua.mxes.net [IPv6:fd::1])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by smtp.mxes.net (Postfix) with ESMTPSA id A3F6675983;
 Thu, 28 Jan 2021 00:01:04 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mxes.net; s=mta;
 t=1611810066; bh=U5CrLrZpQpmPTjJh1TblQnzryghkMrzlg+IM9igB3bs=;
 h=From:To:Subject:In-Reply-To:References:Date:Message-ID:
 MIME-Version:Content-Type;
 b=RkJPz2q7G5sxMH0Kr4kogvz+FKW7sSTNI3yrKw7DdQdnRqfnYt7CMb7SbaZGnZr2o
 BuqtO85TUQG+uWlWvz+9EnzWyw6WoAzusXouMoYvEL0ZmNQkGGT/Q/GwK/gNJrgSF9
 9f5UPcfarXpxb4jFuzmZ+d4GpV8n4jhuqKj42D0I=
From: Timmy Douglas <mail@HIDDEN>
To: JOULAUD =?utf-8?Q?Fran=C3=A7ois?= <Francois.JOULAUD@HIDDEN>,
 Katherine Cox-Buday <cox.katherine.e@HIDDEN>
Subject: Re: [bug#44178] [PATCH] Create importer for Go modules
In-Reply-To: <20210125205910.qvmcusm5w5n4pawy@HIDDEN>
References: <20210123212742.m2thdeuzdvgpkgeo@HIDDEN>
 <87r1mb6zu9.fsf@HIDDEN>
 <20210125205910.qvmcusm5w5n4pawy@HIDDEN>
Date: Wed, 27 Jan 2021 21:01:03 -0800
Message-ID: <87o8h94pv4.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Sent-To: <NDQxNzhAZGViYnVncy5nbnUub3Jn>
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 44178
X-Mailman-Approved-At: Thu, 28 Jan 2021 03:16:01 -0500
Cc: "44178 <at> debbugs.gnu.org" <44178 <at> debbugs.gnu.org>,
 Helio Machado <0x2b3bfa0@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)


I checked out https://github.com/kat-co/guix/tree/create-go-importer:

$ ./pre-inst-env guix import go -r github.com/coredns/coredns
;;; note: source file /s/timmy/guix/guix/import/go.scm
;;;       newer than compiled /home/timmy/.cache/guile/ccache/3.0-LE-8-4.3/s/timmy/guix/guix/import/go.scm.go

Starting download of /tmp/guix-file.jkncVo
From https://proxy.golang.org/github.com/coredns/coredns/@v/v1.8.1.mod...
 v1.8.1.mod  2KiB                     870KiB/s 00:00 [##################] 100.0%

Starting download of /tmp/guix-file.GtI9fs
From https://proxy.golang.org/k8s.io/klog/@v/v1.0.0.mod...
 v1.0.0.mod  68B                      189KiB/s 00:00 [##################] 100.0%
Backtrace:
In ice-9/boot-9.scm:
  1736:10 13 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
          12 (apply-smob/0 #<thunk 7fdc57f964e0>)
In ice-9/boot-9.scm:
    718:2 11 (call-with-prompt _ _ #<procedure default-prompt-handle?>)
In ice-9/eval.scm:
    619:8 10 (_ #(#(#<directory (guile-user) 7fdc57be3f00>)))
In guix/ui.scm:
  2154:12  9 (run-guix-command _ . _)
In guix/scripts/import.scm:
   120:11  8 (guix-import . _)
In ice-9/eval.scm:
    159:9  7 (_ _)
In guix/import/utils.scm:
   464:27  6 (recursive-import _ #:repo->guix-package _ #:guix-name _ ?)
In srfi/srfi-1.scm:
   586:17  5 (map1 (("k8s.io/klog" #f) ("k8s.io/client-go" #f) (?) ?))
In guix/import/utils.scm:
   453:33  4 (lookup-node "k8s.io/klog" #f)
In guix/utils.scm:
    700:8  3 (call-with-temporary-output-file #<procedure 7fdc464b03?>)
In ice-9/eval.scm:
   293:34  2 (_ #(#(#(#(#(#(#(#(#<directory ?> ?) ?) ?) ?) ?) ?) ?) ?))
    155:9  1 (_ #(#(#<directory (guix import go) 7fdc55b65f00>) #f))
In unknown file:
           0 (list-ref #f 1)

ERROR: In procedure list-ref:
In procedure list-ref: Wrong type argument in position 1: #f



This is due to:

(go-module->guix-package "k8s.io/klog")

The temp file looks like this:

module k8s.io/klog

go 1.12

require github.com/go-logr/logr v0.1.0



-> (fetch-module-meta-data '("github.com/go-logr/logr"))
-> (string->uri (format #f "https://~a?go-get=1" module-path)) -> #f
-> (http-fetch #f)

Is there a better way to debug this? `guix import` kicked me back to the
cmd line instead of the guile debugger, which is understandable for
users, but the stacktrace is missing a lot of information. I opened
emacs and geiser and had to eval a bunch of things to narrow it down. It
feels like I'm doing it wrong. (I don't have much experience with scheme)





Information forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.

Message received at 44178 <at> debbugs.gnu.org:


Received: (at 44178) by debbugs.gnu.org; 28 Jan 2021 07:29:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 28 02:29:41 2021
Received: from localhost ([127.0.0.1]:47008 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l51kL-0001xQ-0g
	for submit <at> debbugs.gnu.org; Thu, 28 Jan 2021 02:29:41 -0500
Received: from mx08-00115501.pphosted.com ([91.207.212.23]:3570)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <prvs=96622c012d=francois.joulaud@HIDDEN>)
 id 1l51kJ-0001xI-7p
 for 44178 <at> debbugs.gnu.org; Thu, 28 Jan 2021 02:29:40 -0500
Received: from pps.filterd (m0030078.ppops.net [127.0.0.1])
 by mx08-00115501.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id
 10S7Oaf2010382; Thu, 28 Jan 2021 08:29:37 +0100
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=radiofrance.com;
 h=from : to : cc :
 subject : date : message-id : content-type : mime-version;
 s=radiofrance20190306; bh=loqBn6OKkA/5bJsnzNC/Z08Higv64YQ49M+N+yA6a+g=;
 b=WhPdNbe4p/cZpPTCK369BH/CRovmIbCBdKTAR5kFO1KCdq9OFhALhqAlQce9RInT/Q9Q
 yJslnOPhdtEtrIbZRq6UkT5oCe6OmhHKMpk3zy4SvS3QDOHuZVxDJaFcS0wShqTl4Y5w
 UFUVbKv+yu6R2z5Pzck2suPeh+2feJQHMoOYaQPcSLrz4NhZaCLXYstRtSmbrU2g8pA3
 1CTNj/aR5LPULGN7Kr58E1+nYOnDK2SZRDLkbF2uEjW5DNcYngtKiNLr/h5M0oTIQfan
 n7KIo7aNuYJ8p2iSjXEoLCVfXXwyiIP5XlYaJ6H2HZXA86SUDS7J5kD5lqXL7/k1/ihW 8A== 
Received: from fra01-mr2-obe.outbound.protection.outlook.com
 (mail-mr2fra01on0103.outbound.protection.outlook.com [104.47.25.103])
 by mx08-00115501.pphosted.com with ESMTP id 3688byr2e2-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
 Thu, 28 Jan 2021 08:29:37 +0100
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=iQ+q9qJkInV6mCTfE6WFhvQUyLKe9ovKxISStFX/pmlOgGwa1y4JIG4Q7r0iO2tJv/w6SPQ7XdlG3PouyqAe1mwnb8X2otpOAEXSNDkZzJeWzNmuVrsWE7TmgEj9FuSivxwyyK1nyUGUHqVnK+7K5j6TKYU/K45hm1b56QbRgJ4MWL1ROf8xUW+w3rhRibxfNLVTsMPSgrx4PHArXB3njVqY2WufYYjTjpPodetyBxlEaUvGvsYyAFTSAkl33qRBQF3Tuqnh0bOj/0ZmKioBocKJRLJIIBue8TPBU6TPc8gVfas1Ru0BPmb3CjJJDqGHGa3Ebw85tXFqb3qm+xZ3fA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=loqBn6OKkA/5bJsnzNC/Z08Higv64YQ49M+N+yA6a+g=;
 b=CLdJkhEnF6kRiY0G2/RKkrOO+POYGW+NCIrpmShJ2X2fzSZFk4Jl0MsHaWRcOw+D8w3R3s6dz6Yuthwl9t0JWfQyDvfDDydXnOGAcC2gg2Usrm627sUJx6hWt3CM325qlguSPbgUYxEYsrCTrrMoMTLhJ5YPmFcB/Q0fage0c5gaGLaHZxR1OQ6aGidtb5LctNT266rSyo1FMIzIQPN86ChGDAQuqdCZ84XnYHxguVsKzRz4Hz4sN5p7WbHZMOf34wUZzAOSZflPqGHB6d4nBB2XdEow2ZUCw3zYcBYjKC6LLuFPAh4vwvdwd/6zsx9WNjYCeJOJArSsALn1qsPL5Q==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=radiofrance.com; dmarc=pass action=none
 header.from=radiofrance.com; dkim=pass header.d=radiofrance.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=RFonline.onmicrosoft.com; s=selector2-RFonline-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=loqBn6OKkA/5bJsnzNC/Z08Higv64YQ49M+N+yA6a+g=;
 b=ghok/i1c9pZA+xIbDz+NXm1cN4bJtP0Au5dR+LAv6KzAC8pCZeOFWWuSbrDkAPwc7+erKOyQPGcuzNgW4vGezFdHaZHryE74oY0oB5KIRfbGCIHuhQTm8IpLOqwKMtN5cDfIEvhUs1aDT2v/TE1c3mXVXPw+vgRXfl8BDLeDS3I=
Received: from PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:b::20) by
 PR0P264MB1241.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:161::6) with
 Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.3784.15; Thu, 28 Jan 2021 07:29:36 +0000
Received: from PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM
 ([fe80::51bc:289d:ff1a:6b58]) by PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM
 ([fe80::51bc:289d:ff1a:6b58%6]) with mapi id 15.20.3784.017; Thu, 28 Jan 2021
 07:29:36 +0000
From: =?utf-8?B?Sk9VTEFVRCBGcmFuw6dvaXM=?= <Francois.JOULAUD@HIDDEN>
To: Timmy Douglas <mail@HIDDEN>
Subject: RE: [bug#44178] [PATCH] Create importer for Go modules
Thread-Topic: [bug#44178] [PATCH] Create importer for Go modules
Thread-Index: AQHW9UdUT36mY6n4dkKGqkluHWEIBA==
Date: Thu, 28 Jan 2021 07:29:36 +0000
Message-ID: <PR0P264MB0425A31012E95E446788A61B96BA9@HIDDEN>
Accept-Language: fr-FR, en-US
Content-Language: fr-FR
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
authentication-results: timmydouglas.com; dkim=none (message not signed)
 header.d=none;timmydouglas.com; dmarc=none action=none
 header.from=radiofrance.com;
x-originating-ip: [93.22.148.148]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 180f7f89-7eca-4092-8886-08d8c35e772d
x-ms-traffictypediagnostic: PR0P264MB1241:
x-microsoft-antispam-prvs: <PR0P264MB124195A6E865ACF91C4904D896BA9@HIDDEN>
x-ms-oob-tlc-oobclassifiers: OLM:1265;
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: ADPZM3hZirbXY8k8q/ebsG1geEbye0dp7Z4p6aoWibzCFy/8ZUcSAt16nnvnn7lm4cHe/tCNbDwSwqV7zEYxz3j1epJ67fnaa00CCAaqKYprGzBGVYoR7vsfDe/00GMEs9cqhJj0ivf0IuEV24zopV4X3euba68dZM68p+ukgPKMDh4TQG0wkpcBmAzfmY1Ary+Z29yYSJSwrLx6au71fxOQWJc5qJFLhFySSS3gQ2tkkkohvVVNeseG1egbtLpjxpaEbNNQBG7LHLQgWrZ+izhSJaKXIqr/Dg3RQQmT0rFvkbcavDNXM0GD/wseQhiLw+P++YE1lvyAi5BsNYwUmF6V3f352eKr6SXblA0VF5KZ57bCtw8zFkix1HML21oEZwRv9SukXoBVj4LdL7IOElEli+54RbLWJbedGOAho2E6cKONo05UWzJkp+hsqiZsVFtMhDh/8ipc47Tul8IbWy0R3StlgBM+nw60FDpNGdepcvabUF4ykapkrWyEUHugO9cF5Jb6S6KnItvGSJCVNg==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM; PTR:; CAT:NONE;
 SFS:(4636009)(136003)(396003)(346002)(366004)(376002)(39850400004)(71200400001)(76116006)(8936002)(66446008)(52536014)(55016002)(91956017)(6916009)(186003)(7696005)(85182001)(6506007)(85202003)(2906002)(66556008)(66476007)(316002)(4326008)(86362001)(66946007)(558084003)(64756008)(8676002)(5660300002)(26005)(478600001)(9686003)(33656002);
 DIR:OUT; SFP:1101; 
x-ms-exchange-antispam-messagedata: =?utf-8?B?V3dXb3ZMMkJ6Y2hVaTA3cC91ckdPRWk2NFVYdjNDdFM3YkNENmhkM056Mytq?=
 =?utf-8?B?eUhUZm5oUUl5bTZLLzhGM2haODBITml6TnZsUHdsZk5KTFZCSlJuQVp1MG5z?=
 =?utf-8?B?OXpOUEhUTVlKZG0reVZnQmZaL3pwQkpHSFREUy9SOStiWmRGVWNnUStHb0Nv?=
 =?utf-8?B?UG1yWmo4S3FWQzJ0aFdrMWJUQ0NVS0E5bDlkZktSQ3hJUFhtOXd5ZVlFOU1Y?=
 =?utf-8?B?aU9vYjRBY3k3RnUzMWxocnhmQ3FkajJkMTk4bEpiRmRpd1prMUJndFBGSWFI?=
 =?utf-8?B?Q3RtSHpGV0wzMjh1V25FQ3NDK0FEekFmZmdnMUVBSjBmTm00QnM3RGhxa2xx?=
 =?utf-8?B?bldPeHlhYU9KYy9XS0NyRTZVNVQrbVlTcWppcVFoSWlwUEtQa3loV2RydlE3?=
 =?utf-8?B?c3A4U1ZxU0pYUTBNdTFac0xlcE9xSXg3ZW5obzFmTlBITkliUGk4b1VoTTRH?=
 =?utf-8?B?TTQ1YWtyN25sMUQ0UFlJbzQ5ZGg4Mmg4K1pYTWxlWk9oVmJUVEdGNVYzV0E0?=
 =?utf-8?B?RWlSWEpWQUhsRUc4SElsN3M4RUtFSnluK0VFUU1rb3c4MFhwN094bExXSGlG?=
 =?utf-8?B?VnYrV3lzWW5nRlNRT1hEZjhNWHI0NXlsa0NXbG5ldmE0Slp5TTEyVFhvbWN3?=
 =?utf-8?B?Rko2M2J0SVp4eTgzSFk2WE15VTBjMEdJeEpRVGpXdEtkUERNaTZqeUdqQmps?=
 =?utf-8?B?bkhVdG9xT3FmUFcvL2NXTzg1SUZYbExSYzVqQ0U5eG5FWDVsZGJCU25Jakcw?=
 =?utf-8?B?YWNQQ2Y3MXQzeWwrUTlsVm9NZDRKU0hDbmxIWTRZZCsvcXZMRVpuck96R3ZF?=
 =?utf-8?B?ZlpKTnNsZ01vVGYrckVFU0NKK3Q5NGhwYnVFbVVxVXdMQlF4cGFmcHpMRHVN?=
 =?utf-8?B?anc4Vml1RzNPTEY4NlBQb0ZlVTdOeXlSUU8wMyt1U3ZGYmdZaEExcVpodkpa?=
 =?utf-8?B?Zlh5bEpoRUkraVZTWHpCQVU5ZzZ1cCtNd0VsYzJNTFMvUXQ0QjN6aDZsaUsr?=
 =?utf-8?B?VHd0aVExbVl3QnNsVit0OEVVajVwemVySVFQMEMxRjZSSGZ2NFBaTENBa3Zq?=
 =?utf-8?B?Zkx5ZWlqanRTQVhqd3N5Q0dvenFCS2JPWUcvbnpMYzlzNDJTVGo2UkJLSjF5?=
 =?utf-8?B?azlRZHc2ZTV0Zk8wc2ZJTEdqNlZqL3k5NW5GTmZFSDE5L0lsa3hjVytVZ21N?=
 =?utf-8?B?dXlQNVk5Rkhzb2d1ZTZucmhSZU92Y0c0eHdLZTdPYVVxeWRLTC9NMGhqYU4r?=
 =?utf-8?B?Sk1ndDVkNXVMYWE2WG5ES2UxOVNIcHhKYnJ2ajkzaFFIeFBzcW5MNFJ4bVBM?=
 =?utf-8?B?Z2NlSDFFaFgxUDhyb2EvOWdjckszZG55bWhOdEd5YW9STnRSL3VWQU8xemRk?=
 =?utf-8?B?dkllcTNrUitZQkNyckhCN3JKOW1CRlNlVUxHRFZoVHRlOGU4dTR0aXB6MlA2?=
 =?utf-8?Q?tfQNNxNX?=
x-ms-exchange-transport-forked: True
Content-Type: multipart/alternative;
 boundary="_000_PR0P264MB0425A31012E95E446788A61B96BA9PR0P264MB0425FRAP_"
MIME-Version: 1.0
X-OriginatorOrg: radiofrance.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-Network-Message-Id: 180f7f89-7eca-4092-8886-08d8c35e772d
X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jan 2021 07:29:36.5570 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 1d643b07-8cf5-4e2d-ad1e-86d6b948fc3b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: DDQBYtyIwNWw6FFGhsQdJWoG8oqdnupUE7CH+vJPX4t2cQ83Kgq49DrSKz8T9y/RZuPwlhiL8Zlokc/FA8/hEAlw2YIbBixkGK9k5su3DtYGPueklcmQNO2MfViZQZLF
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR0P264MB1241
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737
 definitions=2021-01-28_02:2021-01-27,
 2021-01-28 signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0
 phishscore=0 clxscore=1015
 impostorscore=0 lowpriorityscore=0 mlxlogscore=576 spamscore=0 bulkscore=0
 adultscore=0 malwarescore=0 suspectscore=0 priorityscore=1501
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000
 definitions=main-2101280035
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 44178
Cc: "44178 <at> debbugs.gnu.org" <44178 <at> debbugs.gnu.org>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--_000_PR0P264MB0425A31012E95E446788A61B96BA9PR0P264MB0425FRAP_
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64

SGVsbG8sDQoNClByb2JsZW0gd2l0aCBrOHMuaW8gaXMga25vd24uDQoNCkkgdGVzdGVkIGh0bWxw
cmFnIHF1aWNrbHkgeWVzdGVyZGF5IGFuZCBJIHRoaW5rIEkgY2FuIGNvbWUgdXAgd2l0aCBhIGZp
eCBzb29uLg0KDQpSZWdhcmRzLA0KRnJhbsOnb2lzDQoNCg0KDQpFbnZvecOpIGRlcHVpcyB1biBv
cmRpcGhvbmUuIFZldWlsbGV6IGV4Y3VzZXIgbGEgYnJpw6h2ZXTDqS4NCg0KDQo=

--_000_PR0P264MB0425A31012E95E446788A61B96BA9PR0P264MB0425FRAP_
Content-Type: text/html; charset="utf-8"
Content-ID: <35ED79888BDB1248B452905F5DFF46FC@HIDDEN>
Content-Transfer-Encoding: base64

PGh0bWw+DQo8aGVhZD4NCjxtZXRhIGh0dHAtZXF1aXY9IkNvbnRlbnQtVHlwZSIgY29udGVudD0i
dGV4dC9odG1sOyBjaGFyc2V0PXV0Zi04Ij4NCjwvaGVhZD4NCjxib2R5IGRpcj0iYXV0byI+DQo8
ZGl2IGRpcj0iYXV0byI+SGVsbG8sPC9kaXY+DQo8ZGl2IGRpcj0iYXV0byI+PGJyPg0KPC9kaXY+
DQo8ZGl2IGRpcj0iYXV0byI+UHJvYmxlbSB3aXRoIGs4cy5pbyBpcyBrbm93bi48L2Rpdj4NCjxk
aXYgZGlyPSJhdXRvIj48YnI+DQo8L2Rpdj4NCjxkaXYgZGlyPSJhdXRvIj5JIHRlc3RlZCBodG1s
cHJhZyBxdWlja2x5IHllc3RlcmRheSBhbmQgSSB0aGluayBJIGNhbiBjb21lIHVwIHdpdGggYSBm
aXggc29vbi48L2Rpdj4NCjxkaXYgZGlyPSJhdXRvIj48YnI+DQo8L2Rpdj4NCjxkaXYgZGlyPSJh
dXRvIj5SZWdhcmRzLDwvZGl2Pg0KPGRpdiBkaXI9ImF1dG8iPkZyYW7Dp29pczwvZGl2Pg0KPGRp
diBkaXI9ImF1dG8iPjxicj4NCjwvZGl2Pg0KPGRpdiBkaXI9ImF1dG8iPjxicj4NCjwvZGl2Pg0K
PGRpdiBkaXI9ImF1dG8iPjxicj4NCjwvZGl2Pg0KPGRpdiBpZD0iY29tcG9zZXJfc2lnbmF0dXJl
IiBkaXI9ImF1dG8iPg0KPGRpdiBzdHlsZT0iZm9udC1zaXplOjg1JTtjb2xvcjojNTc1NzU3IiBk
aXI9ImF1dG8iPkVudm95w6kgZGVwdWlzIHVuIG9yZGlwaG9uZS4gVmV1aWxsZXogZXhjdXNlciBs
YSBicmnDqHZldMOpLiZuYnNwOzwvZGl2Pg0KPC9kaXY+DQo8ZGl2IGRpcj0iYXV0byI+PGJyPg0K
PC9kaXY+DQo8ZGl2Pjxicj4NCjwvZGl2Pg0KPC9ib2R5Pg0KPC9odG1sPg0K

--_000_PR0P264MB0425A31012E95E446788A61B96BA9PR0P264MB0425FRAP_--




Information forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.

Message received at 44178 <at> debbugs.gnu.org:


Received: (at 44178) by debbugs.gnu.org; 27 Jan 2021 14:39:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 27 09:39:05 2021
Received: from localhost ([127.0.0.1]:44110 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l4lyH-0005uu-BD
	for submit <at> debbugs.gnu.org; Wed, 27 Jan 2021 09:39:05 -0500
Received: from mail-io1-f44.google.com ([209.85.166.44]:45079)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <cox.katherine.e@HIDDEN>) id 1l4lyF-0005ug-8R
 for 44178 <at> debbugs.gnu.org; Wed, 27 Jan 2021 09:39:00 -0500
Received: by mail-io1-f44.google.com with SMTP id p72so2022008iod.12
 for <44178 <at> debbugs.gnu.org>; Wed, 27 Jan 2021 06:38:59 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=oG+u2aqsC/nRCv4LkvIeDSrdsmmZkakZ5eisqO+AGtc=;
 b=dFu9yONWO9YDvIQ+0gi7l4kg2UqsfVJ4DfBmgrooEfIoYS8TJcoLtgF4OfDE9yxgjD
 W4S16b7Glz90aBsEthaxm4eqsXX4mp+fMYjr8godQUwzEMPyARaUX2oOBn4D7z73/p7n
 MsDDsqa6S6YP/XmTDsHKm59ejW4l8OAto1RxWhJA9REWSyWnJtroVX+6ogc8+g3jCvBC
 7qJePasjKVl+3RrEdfAVfCG7EXxn49uTL7e4H+Kw74I9FsFZ7F+fiCUA4zsQmYD1ftU+
 TFJ2+L4VfPyyVRa9brpflfOzzm0hT6vxp4Bg9/91FKR+4tdrTBZh6zWqd4YQiaoSS5MF
 ymcw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=oG+u2aqsC/nRCv4LkvIeDSrdsmmZkakZ5eisqO+AGtc=;
 b=BX+MmIeNhskvNzwT3Plamz4pPBfOYttXBB+hUSceFIiiLFHGyR7IL/qNh9Rz68Flly
 8eQTrAfIICTmF6i+sA6IrBBe/twn6ZpPIx213JgEBsWazGGMDmo2Q5NA8y1lMBJMn8Dk
 sNkLL5B9igGdbDu7vhact3TXSsexddZKLLcRFyHs615+FcwS0wKMEUoqZ3tdpQyBfgmE
 3ijUnn0CUJid+4RVUJQaQCyPoGsieecAVX6sEfphM+Ay2Jkj2ZSu50rYlU4UnvE9dtpy
 CUpJlOJcjy+6tbuT75l4feadFASQbj73Indy+ibmKJSpoePYkWBcXFlgghiaz5ocSB36
 EFig==
X-Gm-Message-State: AOAM533TO10bMZEcN+fFPLGxxVr9JTqFqya9G/+Ndq6hm7ZO1eGY32SY
 h9Z1jR1a7AeHFkWJLIBMsyk=
X-Google-Smtp-Source: ABdhPJwjZpx5hn2WiuPAcmBYG+yHtzt3vXvrGt2Q0R480DUK4Ue0A6O/jiC9xoakxYwrRXU4ZDmXtg==
X-Received: by 2002:a05:6602:8da:: with SMTP id
 h26mr7773334ioz.154.1611758333646; 
 Wed, 27 Jan 2021 06:38:53 -0800 (PST)
Received: from washu-v4 (172-221-246-205.res.spectrum.com. [172.221.246.205])
 by smtp.gmail.com with ESMTPSA id
 c9sm1156597ili.34.2021.01.27.06.38.52
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 27 Jan 2021 06:38:52 -0800 (PST)
From: Katherine Cox-Buday <cox.katherine.e@HIDDEN>
To: JOULAUD =?utf-8?Q?Fran=C3=A7ois?= <Francois.JOULAUD@HIDDEN>
Subject: Re: [PATCH] Create importer for Go modules
References: <20210123212742.m2thdeuzdvgpkgeo@HIDDEN>
 <87r1mb6zu9.fsf@HIDDEN>
 <20210125205910.qvmcusm5w5n4pawy@HIDDEN>
Date: Wed, 27 Jan 2021 08:38:51 -0600
In-Reply-To: <20210125205910.qvmcusm5w5n4pawy@HIDDEN>
 ("JOULAUD =?utf-8?Q?Fran=C3=A7ois=22's?= message of "Mon, 25 Jan 2021
 21:03:01 +0000")
Message-ID: <87sg6mmolg.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 44178
Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>,
 "44178 <at> debbugs.gnu.org" <44178 <at> debbugs.gnu.org>,
 Helio Machado <0x2b3bfa0@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

JOULAUD Fran=C3=A7ois <Francois.JOULAUD@HIDDEN> writes:

> Hello,
>
> On Sat, Jan 23, 2021 at 04:41:18PM -0600, Katherine Cox-Buday wrote:
>> Thanks so much for the patches, Helio, Joulaud!
>
> You're welcome! As a side note I prefer to be adressed as "Fran=C3=A7ois"
> ;-)

I'm very sorry, Fran=C3=A7ois!

>> I have pushed everything (including Joulaud's patch with appropriate
>> attribution) here[2]. I am admittedly new at using email to organize
>> code changes, but using a forge seems easier.
>
>> Can I suggest we coordinate there, or is that too much of an imposition?
>
> I have no problem to coordinate in a forge and can push in a shared
> branch if you give me access.
>
> Even if I must say I found it refreshing to be able to work with mails. It
> has the nice property of fully-offline and asynchronous communication
> and it helped me to better articulate my problems.

OK, how about we stick to the preferred Guix approach then and
coordinate here. Maybe you can teach me some things along the way :) I
do like the idea of an email-based forge!

The main problems I've had thus far are:

- The inter-diff patch you sent was not formatted correctly because it
  contained some extra leading whitespace. I found myself juggling a few
  different tools just to understand your changes.
=20=20
- The conversation about this seems to be happening in 3 different
  places: here, help-guix, and guix-devel. I guess we should be
  centralizing here.
=20=20
- I don't have any experience coordinating with people in this
  email-style forge. I don't know how the inter-diff patches work with
  attribution, nor how to get everyone on the same page. It seems like
  multiple people are making conflicting changes at once (maybe that's
  just my perception).

--=20
Katherine




Information forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.

Message received at 44178 <at> debbugs.gnu.org:


Received: (at 44178) by debbugs.gnu.org; 27 Jan 2021 14:31:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 27 09:31:50 2021
Received: from localhost ([127.0.0.1]:44106 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l4lrK-0005l5-FO
	for submit <at> debbugs.gnu.org; Wed, 27 Jan 2021 09:31:50 -0500
Received: from mail-io1-f49.google.com ([209.85.166.49]:33374)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <cox.katherine.e@HIDDEN>) id 1l4lrJ-0005kt-7T
 for 44178 <at> debbugs.gnu.org; Wed, 27 Jan 2021 09:31:49 -0500
Received: by mail-io1-f49.google.com with SMTP id q129so2048212iod.0
 for <44178 <at> debbugs.gnu.org>; Wed, 27 Jan 2021 06:31:49 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=u/CmG5FTW/hs/0K70KZEImhaONhUwJ0MGav121V+hFM=;
 b=LngMACNKW9xmGQEV5b/H9mMWXpY+tqfTI2+liUWR2Sjkx9TszpSvpO0Wrf4zkKoROt
 ZxcjVDFutl2ezDHQDHwo0q3B6vW4y0nC1zje09tLOCYK2VjEU0XGp19Mym/5UsftNAXw
 JtZ7GMXsQ9LZb/IPgXgYtFzWswbm0+gf6Rh09LAxS7ysoCEuCmmgDG4R6RyzGRAdqT89
 4BFZiXrw+eaznlz7kRxXJxetyBI/0oq+uZ0gBCeeAiGAuKvmZKkxCHyQ6P2Chtw7czWZ
 wZJfvpXrJOM92DbIAUFBWD/72S/PtLP8rkmIS3D4KAVKRSefQ+5xtPTDCZ3vsf0Wl8XN
 92sQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=u/CmG5FTW/hs/0K70KZEImhaONhUwJ0MGav121V+hFM=;
 b=KNgCAaBaL7fFIyllsMJOwX5XJzCcF3G4VekNG0aYH4zbQddzK55tqM5BDli6aA92Y+
 jEBgPAod0XzXj6ka4uR0xSauHS5aAWMhasCWrs/1Sxk7Opad9MeDlFVM8nIhaP+qn2/m
 Skd5qTn+Rb3TJqEqhdX16D4hI4teGHPZdHjlQlf7OcaWhkbwpjcLmCloDHfJdRBm2mH+
 cgsLlrLL2FWQOFUoat5zSn5HPcI0kUOCneOxAUveIq3jNbFEC5tunU9JU2FiVk98D9g1
 WTjzzHUxX5OUma9YTUTVxZSlaSCe5bm/YZ01UxIHK29PIYEH6JjXdcAauwhJUwUF7N49
 oJZA==
X-Gm-Message-State: AOAM530X47JXy3VVG/fDxzLRfPgcH0l4Cau9cg4VpT+QlfIBWBRddIDl
 uBThlmj5QHBAFuqIdLyiTYU=
X-Google-Smtp-Source: ABdhPJyghzR/b3IQs0VM7s0D8GlPY1D3ZwZ08D+PNV85/Tz4fXz8oXpVfYRZjAh0RFxtEPkDUnNOYw==
X-Received: by 2002:a05:6602:2c4e:: with SMTP id
 x14mr7736968iov.58.1611757903512; 
 Wed, 27 Jan 2021 06:31:43 -0800 (PST)
Received: from washu-v4 (172-221-246-205.res.spectrum.com. [172.221.246.205])
 by smtp.gmail.com with ESMTPSA id
 i72sm1070151ioa.6.2021.01.27.06.31.41
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 27 Jan 2021 06:31:42 -0800 (PST)
From: Katherine Cox-Buday <cox.katherine.e@HIDDEN>
To: 44178 <at> debbugs.gnu.org, JOULAUD =?utf-8?Q?Fran=C3=A7ois?=
 <Francois.JOULAUD@HIDDEN>
Subject: Re: packaging a golang package
References: <87h7nrud2a.fsf@HIDDEN>
 <4bdbc469-ad45-4739-b001-739ad3a60adc@HIDDEN>
 <87a6thtyvm.fsf@HIDDEN> <87bldw0ztb.fsf@HIDDEN>
 <CANe01w6HZv4=n4HmfdtZECb78wT5SDA8PafbKmntgqDwav-yWA@HIDDEN>
 <20210125204534.ovhvt7rzj7tbqrnt@HIDDEN>
Date: Wed, 27 Jan 2021 08:31:41 -0600
In-Reply-To: <20210125204534.ovhvt7rzj7tbqrnt@HIDDEN>
 ("JOULAUD =?utf-8?Q?Fran=C3=A7ois=22's?= message of "Mon, 25 Jan 2021
 20:49:02 +0000")
Message-ID: <87wnvymoxe.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 44178
Cc: guix-devel@HIDDEN, "help-guix@HIDDEN" <help-guix@HIDDEN>,
 Helio Machado <0x2b3bfa0@HIDDEN>, Timmy Douglas <mail@HIDDEN>,
 Leo Famulari <leo@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello again, Fran=C3=A7ois! I've redirected this thread to guix-devel, and
the bug since we've begun discussing implementation details.

JOULAUD Fran=C3=A7ois <Francois.JOULAUD@HIDDEN> writes:

> First is to use vendored dependencies (when upstream provides them). This
> one has the merits of simplicity (as we just have to download the
> source and launch `go build` or whatever is needed) and less risks of
> bugs. The downsides are known: difficult to audit Licences, duplication
> of code source, difficulty to follow security bugs, etc.

-1 to this approach (explanation below).

> Second is to re-vendor package from go.mod (coming directly from code
> source or synthetized from source) by creating a source derivation
> including all dependencies. This is the strategy followed by Nixpkgs
> as explained in [1]. (It seems to me this is the route followed in
> the patches to  from Helio in [2] but I did not take the time to read
> them.) With this approach we still have some of the downsides of using
> vendored upstream but it is at least easier to verify the existence
> of upstream.

I don't fully understand this approach, so I don't understand how this
is different to approach three? Does this mean we create a pseudo,
non-public package which states all the dependencies as inputs? If so,
why wouldn't we just go with option three?

> Third is to package every dependencies. This is the most transparent way
> and the one that leads to less code duplication but the downside is the
> difficulty to scale with the number of packages (even if the objective of
> patch at [3] is to automate it) and the need to have only one reference
> version for each package in the distribution which have its own share of
> problems (one of them being that we don't use those tested by upstream
> as stated in [4]).

I think this is the eternal conflict between distributions and
code-bases. As a software engineer, I am a fan of vendoring. It removes
entire classes of issues:

- Dependency on remote servers to be up to fetch dependencies and
  perform builds
- Requiring some kind of system to pin versions
- Needing to stay on top of releases even if that doesn't meet your
  schedule or needs

As a packager for a distribution, I dislike vendoring because of the
reasons you outlined above, _but_ I also dislike building upstream
software with versions of dependencies that weren't approved, tested,
and verified, upstream. It seems to me like that's a recipe for
unstable, maybe even insecure, software.

Normally, distributions are forced to do this because their packaging
and build systems are only set up to support one version at a time. Guix
can theoretically support all versions, but doesn't want to take on the
dependency graph explosion this approach would cause.

If we go on historical precedent, and how Guix handles the other
language ecosystems, we should only have one version of each dependency,
and build all software which relies on that dependency on the version we
have packaged. Guix has already begun taking on the difficult challenges
with this approach, including patching upstream to work with versions of
dependencies upstream was not built for.

I dislike it, but I also don't think we should try to solve the broader
class of issues while trying to implement an importer. It should be a
larger discussion within the Guix community across _all_ language
packages about how we might achieve upstream parity while still
maintaining our goals as a distribution, all while not crippling our
infrastructure and people :)

That's my viewpoint, but I think we should all defer to some of the
longer-term maintainers who have helped guide Guix.

Thanks for writing up these options.

--
Katherine




Information forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.

Message received at 44178 <at> debbugs.gnu.org:


Received: (at 44178) by debbugs.gnu.org; 25 Jan 2021 21:03:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 25 16:03:10 2021
Received: from localhost ([127.0.0.1]:40153 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l490v-0000yi-NW
	for submit <at> debbugs.gnu.org; Mon, 25 Jan 2021 16:03:09 -0500
Received: from mx07-00115501.pphosted.com ([185.132.182.48]:47844
 helo=mx08-00115501.pphosted.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <prvs=86595c9de9=francois.joulaud@HIDDEN>)
 id 1l490t-0000yZ-Ve
 for 44178 <at> debbugs.gnu.org; Mon, 25 Jan 2021 16:03:09 -0500
Received: from pps.filterd (m0001505.ppops.net [127.0.0.1])
 by mx07-00115501.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id
 10PKv0BL015879; Mon, 25 Jan 2021 22:03:06 +0100
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=radiofrance.com;
 h=from : to : cc :
 subject : date : message-id : references : in-reply-to : content-type :
 content-id : content-transfer-encoding : mime-version;
 s=radiofrance20190306; bh=pcGnQKCkv479kwfLqk89lQCEBjAr4sZeG4KyThO+RVw=;
 b=JA25OJPjyaGE58itCW+YJPhgrvvHLk3MvV1EO0UVk7Ug0b8gersgWw9dBLZvIirCsGjc
 b01/3dKVVT2APpLVUGLbRg3JMpzgkvo0f841bTMOuMbMtGHZ4q0NUkZrVHPq4Iz0LgV4
 4nMc3EZMBlDzHGAKyB8dI0i8vnnHDZtxO0ZtdFFr2wW3dZ9NAJbN1G+BeQyiMc3PPyyF
 7LLoJ9GRdgXcELut5VWxUPWRTVc8cVlLgNG5u5BC/yOTgWA8BjD2plljnqCqDeNcZncY
 BKXX/0CaPDGM+TWZlnF6w1yVPKtB859RlB+dH5zO46ZXIOIf+/9aFYS0THCO12gtplN0 gg== 
Received: from fra01-pr2-obe.outbound.protection.outlook.com
 (mail-pr2fra01lp0108.outbound.protection.outlook.com [104.47.24.108])
 by mx07-00115501.pphosted.com with ESMTP id 36895rbr0y-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
 Mon, 25 Jan 2021 22:03:06 +0100
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=Ge6Vf5dhuLoLX7+WuL6pFx3r8DuRtkv9VPwDMsSk1V+v0r2YLlPwYNmaqqmqz7r2whM1/Gb0WscisgukaOrSb1nEbxkkLgw9pZ7GB5ze7eU1MDg1oerreszOC7+Ty28n6E5u0hyFIcXxqgRy54mPW1p4j4/BERYxyR1/+8AcRB7SzeAOb0/goI1RTITvZp8c2gJR/KFNuVsUCtn+TW75LZomUlNFAP/WMw5WrR7/mESaGUVstoMvzFgMqOAg00yRnoVZcPVGUXHlMorgKXOm5G2ODhSWInffC3fdUVu5l6rqjLjdL8YO8IeBfOdrpDEFiIhglGa8HjZelKmJt5zBdw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=pcGnQKCkv479kwfLqk89lQCEBjAr4sZeG4KyThO+RVw=;
 b=DTGdw5ZZzFnv7/bC0sdr4v7Nkb1eA0CcoRL/NFxSVpQN84Sxm4QRPiBXQ/Jnhait+JOy8Vd+FcRzwqvyjCv3rGI1Yp3pOjE0Wkn/eTE2V0YbOQ5TfHbINha2QP3ioYpJqEqmSgyuMwLpfdxCSpRyFuin4OBdEr3Y+IbTjIW6jrtO2ttE9NQAwLB0wqfiY6y/2Vsv5QoY2XuCxALApHWfMAM6davVJ0fC/znLYD3XLGDO0hrqs2Dvg+N0KtaFUx2C3urUbuwN7lfV+z9EF/CsaKlC+c7IZHv+OFsb/88QkFHDlV5xjBU5Xio+ItcpqxVBtOG2kmBSc4deP0eWC+HJ0w==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=radiofrance.com; dmarc=pass action=none
 header.from=radiofrance.com; dkim=pass header.d=radiofrance.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=RFonline.onmicrosoft.com; s=selector2-RFonline-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=pcGnQKCkv479kwfLqk89lQCEBjAr4sZeG4KyThO+RVw=;
 b=etfoUz16CAMtmcerH3L3T0xHaZmI+ZDrowm1b0JVO86FNrBzyYMlZlvDBeRSdkg2SONKunkejV5H0LKLFcLbJYO0SpHQjuEGcezpANlLANQ+yMW92T2MxDRCdRwt86e34qLcKMBq2VJkeXWi9DgR2L47tdDOpAJQV+KQ7cNnJCc=
Received: from PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:b::20) by
 PR2P264MB0238.FRAP264.PROD.OUTLOOK.COM (2603:10a6:101:7::19) with
 Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.3784.16; Mon, 25 Jan 2021 21:03:02 +0000
Received: from PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM
 ([fe80::51bc:289d:ff1a:6b58]) by PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM
 ([fe80::51bc:289d:ff1a:6b58%6]) with mapi id 15.20.3784.017; Mon, 25 Jan 2021
 21:03:02 +0000
From: =?iso-8859-1?Q?JOULAUD_Fran=E7ois?= <Francois.JOULAUD@HIDDEN>
To: Katherine Cox-Buday <cox.katherine.e@HIDDEN>
Subject: Re: [PATCH] Create importer for Go modules
Thread-Topic: [PATCH] Create importer for Go modules
Thread-Index: AQHW8c+fh3EThKxKn0aE+FBPMWbUYao1zif4gAMIIAA=
Date: Mon, 25 Jan 2021 21:03:01 +0000
Message-ID: <20210125205910.qvmcusm5w5n4pawy@HIDDEN>
References: <20210123212742.m2thdeuzdvgpkgeo@HIDDEN>
 <87r1mb6zu9.fsf@HIDDEN>
In-Reply-To: <87r1mb6zu9.fsf@HIDDEN>
Accept-Language: fr-FR, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
authentication-results: gmail.com; dkim=none (message not signed)
 header.d=none;gmail.com; dmarc=none action=none header.from=radiofrance.com;
x-originating-ip: [88.126.13.52]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: d70e99bf-fdb7-4d6a-2b37-08d8c1749a2f
x-ms-traffictypediagnostic: PR2P264MB0238:
x-ms-exchange-transport-forked: True
x-microsoft-antispam-prvs: <PR2P264MB02385CFF02F63E101A4668C996BD0@HIDDEN>
x-ms-oob-tlc-oobclassifiers: OLM:9508;
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: X0eMOyKzs/z+tBeVSLuskaZiCLX+z9Cx+IoFwy1l3YYNnJV6caTibDyhh/Ka1voGrfz4a8mCYTn8gE3KTufgiKka94l3THf6ooEe5J0kxKgpcc7FJQQEeYqfBsLgu2DqmLDwGKRK7ihUA4PlyVuw8bVDczs+e0kztOmO1UH4E73CeAFUONs/K9PzNBIg1yyLnKYJ92/ZFUBVa32oGRxfsbhO+tvVmanuLWSQ4SfwPGFEfZwCrPrUFj3/hkqhvPF2n3mBP1B1KsFqjwC7tJ7bh+VKLyfTp5403V3VrKZb54WC2rw+URyFBavgQOJT4nFbsg42u7Dg7UqCmaawDjWhjCRv7tWNHFTPS2Q6+JYK9yQvqPO9Vqh5zEI6uLGKBNXd1mh9tyF6xWRQ5YX6+1qALQ==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM; PTR:; CAT:NONE;
 SFS:(4636009)(396003)(376002)(366004)(39850400004)(136003)(346002)(4744005)(66574015)(6506007)(316002)(6486002)(86362001)(83380400001)(71200400001)(6512007)(5660300002)(8936002)(4326008)(1076003)(26005)(186003)(2906002)(8676002)(64756008)(66946007)(6916009)(66446008)(478600001)(66556008)(54906003)(76116006)(66476007)(9686003);
 DIR:OUT; SFP:1101; 
x-ms-exchange-antispam-messagedata: =?iso-8859-1?Q?WzJP7ZD5EPVyRbshm+QVfHvKMxYcbKkBfMjMAcWShHuzzR3CVApf+Qgw3r?=
 =?iso-8859-1?Q?wA/mll0L/8fIbmjSUhCN4rl4I4GWaPpYbzdLeHf8fFaOetFMwZBhuTD5c9?=
 =?iso-8859-1?Q?pccpKpLz0CAXlCqUsndj0wkqqW0PjvGHgPV+9Zk1WB7YQNtcO6O7B4NgcM?=
 =?iso-8859-1?Q?2UyN3NRuNBD/gMOc8VjsdkTYwr1QkRjP5pyBsWUbaQt7BxLXlsreLC1ahK?=
 =?iso-8859-1?Q?XMMbY7ILCzivUorkSQwqazXnYm9b3log/lgtn2ziW6oHBer64WnMmYJMRY?=
 =?iso-8859-1?Q?oL0o0IJzShbDNube6uJ5s5ky2GZhW9+TMR2bhcv56CuuBuVAgW5LQuq9vS?=
 =?iso-8859-1?Q?4RbFGDuni3DdQNcKBcPxKDl09PbpAEMtlFHkgbp17NxaIaxZQUwDnF2T5X?=
 =?iso-8859-1?Q?zRdsm5VR7tJA2V8Hh07Q73eeEbV+akZvZUeHL56uKdzkqqVJuG4VbIn3IP?=
 =?iso-8859-1?Q?4iq0aHELSmTcsKrPoIWOx2GIXt8nfl4Q2yM3ldbDxrJAx7Ebt2CLBZALFp?=
 =?iso-8859-1?Q?puHPXAw68ianukmdrIs3RCSoG7i5vktmhwE60dS+J83m3+Q8yOVAUA3RJq?=
 =?iso-8859-1?Q?HJuYHpQKn3bX4qOgVBoqlav5KMR6TpODivPw0qkJjWn2HmdrTMyQA7tcmT?=
 =?iso-8859-1?Q?ynSEejpz10ebK+pMRbSzfB4bPU2nGolIg+xYJYIyObJUACL1BDSyy8UYcj?=
 =?iso-8859-1?Q?Dr0YEB2QiVCwrBEDA8MShhjSA80Y+xGWHY4Mm+Npo0pGRA6iB5C3vj1wCU?=
 =?iso-8859-1?Q?iH9cTEmy282Gbl9Qaa6ewLifj8iG8Gf5QPxO9NSApOQm8J48q6yvx/ZQ5U?=
 =?iso-8859-1?Q?Y4/Z8IkhkVorsUrwlK0zHyu8pw7len2faI3GnfNocecu1BajhJSQA6FaFq?=
 =?iso-8859-1?Q?sWyO9/lDgiP25zzmf0dC4GA3PF4DBkowWhb1xmX0W2776uhiihwxf1MJri?=
 =?iso-8859-1?Q?Dpy2VZTBlNmlw9d9HgZKEe3h6+Awo+Ty1CTyRkFgwI2Cyk7ehZpodZ1LpO?=
 =?iso-8859-1?Q?nsGw+ph350BYfN6V//M11HVgMy9TO5sv5AbFg6yzOCU4X/K/d57W9thZDd?=
 =?iso-8859-1?Q?IPmoNeiAPvdv/7KaVjcE+Q9o9LT0+ynsZnK9PHtepH17?=
Content-Type: text/plain; charset="iso-8859-1"
Content-ID: <F9F0DE76D111E548BFE40BB0D1CDE0F9@HIDDEN>
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: radiofrance.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-Network-Message-Id: d70e99bf-fdb7-4d6a-2b37-08d8c1749a2f
X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Jan 2021 21:03:01.8855 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 1d643b07-8cf5-4e2d-ad1e-86d6b948fc3b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: q3w3Lsa8QmbFYMJ6vcdMjSGsCE42Fq8w7IheR2JukC+6+eNfIIPSLliDs2Obbfrim6q3PjwLoOqPwmoDU3SjVWakoGNbzCegZNTDO8yVUOd2p8BZmsJvFSvkeSefaYtf
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR2P264MB0238
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737
 definitions=2021-01-25_09:2021-01-25,
 2021-01-25 signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0
 clxscore=1015 mlxscore=0
 suspectscore=0 adultscore=0 impostorscore=0 priorityscore=1501 spamscore=0
 phishscore=0 lowpriorityscore=0 mlxlogscore=766 malwarescore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000
 definitions=main-2101250107
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 44178
Cc: =?iso-8859-1?Q?Ludovic_Court=E8s?= <ludo@HIDDEN>,
 "44178 <at> debbugs.gnu.org" <44178 <at> debbugs.gnu.org>,
 Helio Machado <0x2b3bfa0@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello,

On Sat, Jan 23, 2021 at 04:41:18PM -0600, Katherine Cox-Buday wrote:
> Thanks so much for the patches, Helio, Joulaud!

You're welcome! As a side note I prefer to be adressed as "Fran=E7ois" ;-)

> I have pushed everything (including Joulaud's patch with appropriate
> attribution) here[2]. I am admittedly new at using email to organize
> code changes, but using a forge seems easier.

> Can I suggest we coordinate there, or is that too much of an imposition?

I have no problem to coordinate in a forge and can push in a shared
branch if you give me access.

Even if I must say I found it refreshing to be able to work with mails. It
has the nice property of fully-offline and asynchronous communication
and it helped me to better articulate my problems.

Best regards,
Fran=E7ois=




Information forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.

Message received at 44178 <at> debbugs.gnu.org:


Received: (at 44178) by debbugs.gnu.org; 23 Jan 2021 23:23:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 23 18:23:51 2021
Received: from localhost ([127.0.0.1]:35599 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l3SFx-0006jw-Vq
	for submit <at> debbugs.gnu.org; Sat, 23 Jan 2021 18:23:51 -0500
Received: from mx08-00115501.pphosted.com ([91.207.212.23]:30758)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <prvs=86579a1b5d=francois.joulaud@HIDDEN>)
 id 1l3QYq-0001wR-T0
 for 44178 <at> debbugs.gnu.org; Sat, 23 Jan 2021 16:35:15 -0500
Received: from pps.filterd (m0030078.ppops.net [127.0.0.1])
 by mx08-00115501.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id
 10NLUv5S024623; Sat, 23 Jan 2021 22:35:11 +0100
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=radiofrance.com;
 h=from : to : cc :
 subject : date : message-id : in-reply-to : content-type : content-id :
 content-transfer-encoding : mime-version; s=radiofrance20190306;
 bh=c/E7epY40VpNm3Ov0BETlgEjFfGd5m1P1cmMca8kwXs=;
 b=YWMs10D9sjJkknF1SiAFuXdp1e3SMgXV/8cANWHS1OF97CFt4U4IcZKDENduheDwezq5
 vwGMwefubpxojjzmST345FdlGffGTFqPpaPo+aIzo3Bi74wr/ClM7h9P8Iqi33Is3YBg
 PZ9WEhmZdFMwc9yovrp4F4Hc+QRhRh7faXpAiYSubJwAnXLTysJpUEiqAbWQjNYpvKyt
 CCJq+3qVF7lH+1VTYibbF6S36kWnrRDD9fzQiPHwo+YptWFqHAbgZz4fE0cdgxp/u7xK
 HE5MlfWL6Iab6sdHMPaWzoe+HknfToer2HH4cEwZoTRun8shWmk4F0auUHgUtKxh1jNE Zg== 
Received: from fra01-pr2-obe.outbound.protection.outlook.com
 (mail-pr2fra01lp0105.outbound.protection.outlook.com [104.47.24.105])
 by mx08-00115501.pphosted.com with ESMTP id 3688byh1xc-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
 Sat, 23 Jan 2021 22:35:11 +0100
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=LfVN/cdBq/yLjAPbyIBXqyyY5clJH4b5NoGWgJFTO65w1ZL3V1jWZhv6FLroKmFkzVsgd/4C79VsO3g3WyPr3Pv4i5x6YS1b2KwiSd8KUp3buNtid3tJ8a5JrENgGiwutWC2jqUTvBOb1tiSPFy3HzIbhneL+Y16XAd0RG1WKaY6Fmf/1McPeeQ1Hf+ZBFA6qRe9jx445ftMkLF4qvEclDLFJO7fyE/eHoNB9UaGyZx0cAggnb8Tku7nujS2Cybu1d4LFN5MclioIuAIG2SKAUlkDOpXkRe5de6wf48St+aiiaTgwOiCPqgQp7RW9Te6ys7D6PR9RdP9wPaBR9hC9g==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=c/E7epY40VpNm3Ov0BETlgEjFfGd5m1P1cmMca8kwXs=;
 b=iSwmKoYHubU3ILVJ0HzJxGrYHAG3WRUgfAwGOb+Kvvhcw23v9yM0ejgjTM3v2LR4jWj7ZeSObXSZPO8hR2f+wDBu/E1yGEcVy0ReEJTu3XXJLxA4brGxPYS9x3Ehdm5QtdDPN68hJGc5sluLo9wMIwxBtHhgtTrVOXUl718e7/fcXaRMcXs62nG4hgKb54a7gOaQ7buioOn6RUS/fJGtEBR/hZXB0HCnGdmp8eNGeUBKOS8W2WYatjctVEaz1FyyC6NChyc2MEjkHJdn4NV/MgfErTxEB469t2k1GiaEDFqs0e+70xkJxjFbpP7SDLwFxlQYqsafB84Z+315gFJ4Ng==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=radiofrance.com; dmarc=pass action=none
 header.from=radiofrance.com; dkim=pass header.d=radiofrance.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=RFonline.onmicrosoft.com; s=selector2-RFonline-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=c/E7epY40VpNm3Ov0BETlgEjFfGd5m1P1cmMca8kwXs=;
 b=HRLN3aYCqz0zydCI1cH38ZD1cmNSSgGMGcPrh9vq9Y1VgOMqdg0TCssQyCgXnJ4CfUxNiEoyi8ts9iO3pIM9rNae/OqzFOzeaSPd7o4uxlyne+FS4/tu4z+yYYIBS5WMYs60cSdN/pVZX77hXEUPHi6F5HWAru4u5l9p02a3/6c=
Received: from PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:b::20) by
 PR0P264MB0492.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:b::15) with
 Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.3763.14; Sat, 23 Jan 2021 21:35:09 +0000
Received: from PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM
 ([fe80::9b7:6491:8aa7:550b]) by PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM
 ([fe80::9b7:6491:8aa7:550b%3]) with mapi id 15.20.3763.016; Sat, 23 Jan 2021
 21:35:08 +0000
From: =?iso-8859-1?Q?JOULAUD_Fran=E7ois?= <Francois.JOULAUD@HIDDEN>
To: "44178 <at> debbugs.gnu.org" <44178 <at> debbugs.gnu.org>
Subject: [PATCH] Create importer for Go modules
Thread-Topic: [PATCH] Create importer for Go modules
Thread-Index: AQHW8c+fh3EThKxKn0aE+FBPMWbUYQ==
Date: Sat, 23 Jan 2021 21:35:08 +0000
Message-ID: <20210123212742.m2thdeuzdvgpkgeo@HIDDEN>
In-Reply-To: <CANe01w5DxwrF+APLbcNMaUhs4h05EXC1HdRJ_YT8CRy6ULxUYw@HIDDEN>
Accept-Language: fr-FR, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
authentication-results: debbugs.gnu.org; dkim=none (message not signed)
 header.d=none;debbugs.gnu.org; dmarc=none action=none
 header.from=radiofrance.com;
x-originating-ip: [88.126.13.52]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: b4cff3e2-da60-4670-2bdf-08d8bfe6c1e3
x-ms-traffictypediagnostic: PR0P264MB0492:
x-ms-exchange-transport-forked: True
x-microsoft-antispam-prvs: <PR0P264MB0492CC117187DB6836F0088D96BF0@HIDDEN>
x-ms-oob-tlc-oobclassifiers: OLM:4502;
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: rnEERXYaoW2OULCXw/mUlKraibknnUUws9gOkVlVHpMh+RJUhmV4vekN2QYY8I19i78maZw+A+Cb8frsDKk5SSXFeP/5qcTyozvPK2/ax0EjT8okxxY/T+BZSd5asOqzNZVZ+DKiTjf0Gq1wLAJOpDE+PU/wkRz+QhbBdbv421ZwxFgRyBEoCA82tF8vBbN47Rrgh0+0M95zVM3+JB0e3W1XZTngcy0AXcWFFE3Uk3Ee0jH0jOV3TMCGcuY4bRnl6Ujjz4PVtUK7ZnJAZDjD1HKiMjVbHzVhHltj2ltalS8zZgLPPQAzXqL6mg6kXX0eV8BrnhMyiK6Qbr/JQClRonzu3TRGYmtsB37n7Zxu/tv2ZibcRTB1+h1dGfb4RoX+wIEYT8o7FDesILxdaAtRRNRt50ZmMxhkHeiNNjZ+rOybdltobaziRSzM+E7GRFY+Ba0ewGOJfv51nG+XR5r5y4ZzWB0Jum78B6wdBYFbTikcLchbLS/0JK1joNeQMqVxFqIg0IjUCjWhFOtQIAlGVwPPSVaptrrOaQ9nW1bboFTjWfArQZ3ANHaLmj/NJAtqDb2lgXnivzDLfqDcZCdMMvgeDQKG7nCN4Ser9Q+TXHs1ewg8/NEF/J5NMKwbG8GOyo65dyuyc4ExeMvdTD0KBw==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM; PTR:; CAT:NONE;
 SFS:(4636009)(376002)(346002)(39850400004)(136003)(366004)(396003)(8936002)(6506007)(186003)(5660300002)(1076003)(26005)(316002)(4326008)(6486002)(8676002)(64756008)(66446008)(66556008)(66476007)(66946007)(76116006)(2906002)(86362001)(966005)(54906003)(6916009)(83380400001)(9686003)(478600001)(71200400001)(30864003)(66574015)(6512007)(2004002)(579004)(559001);
 DIR:OUT; SFP:1101; 
x-ms-exchange-antispam-messagedata: =?iso-8859-1?Q?gfjjLxBpUS5W8JxwSwrheKPOMubV6kb1Nsnf5ct/xZMf/rIINPxNtnItdG?=
 =?iso-8859-1?Q?gNgLgY/sSoD3kxFxVw2caCjgCbI93lLtVp+wxJAk+CVEeCd86YttxaPt1Y?=
 =?iso-8859-1?Q?c1yvbR2J0v5wY7jS3Q8xDYaOWPp0LSvxaa996hpTEbMjqXGkoBvAke0IEJ?=
 =?iso-8859-1?Q?NxgSYbAS5XDXDZk9DNlIB3p6BVOnJy3RXdOjO2EJnIiP1glKH2pI1BUTlC?=
 =?iso-8859-1?Q?H33HOffUe4JOg8W+lkL/MP2vhL5KGLY4F6X4Jm5jWM2o8zpzI3DIVDKXnm?=
 =?iso-8859-1?Q?ysRzJEyN+CRLKEze6h/UL89l8aUuF+yUTZ7NhxGpXusIYzvbsxhXysPjb6?=
 =?iso-8859-1?Q?EtJZW/Br61O0y661MAJN/BnKnmkVvrxR6TtR1i67nC5qXABWhsaOiKy3AF?=
 =?iso-8859-1?Q?seGZ9oAeETOV9SXSw9SeynhdEPvh2shhdCZW5Kn31ASZ4z+mfnT8bVMOrn?=
 =?iso-8859-1?Q?IVIGxK8KlibQwWkJ/YxOab8vzTcDKijhOFbvm5KHyIvIGuH78VArRKmSKX?=
 =?iso-8859-1?Q?MaM8tZ1ekI/StFAEwI1xfDUN3+nrDDlxmhJ9VRxWSjHNxezbo/fVNrZjQE?=
 =?iso-8859-1?Q?m+p2Fks456Vmw2gko0MCa8tEzV582xk38PUskqPYJJ0Y7J0Hr1weKcfDn5?=
 =?iso-8859-1?Q?S+Ru1q/jWY20votRwFyYyzJNtMdh++FAczxI0x1jyqx9Ej3EqKKpxyx2/e?=
 =?iso-8859-1?Q?YGmBj45FzHaoWMP40/Tx6tJzeHcyhSVrWzvjJ/C1BoEARwSUTELBqR8bCI?=
 =?iso-8859-1?Q?qMhnUzERqs1uqkYyIQl/wWFAtIKLgtA/GQLYsd4Pd49568Cip4JhKvRcXM?=
 =?iso-8859-1?Q?Gr6M8KpkO5bIcbgVRGeZf/cV6KoehNQjif9ZBu3G6NAIu0aUqjYG65AdK+?=
 =?iso-8859-1?Q?ZdCKNnh45pyaEp1nP2Ho4oTW93TUvMPrLXAnffZM6i+QsAAL2JgG8PKODt?=
 =?iso-8859-1?Q?w7c17fiut0ZOgfx8xKTfVU8ZWY7RwT+1Zy2XSbf6y9e7RZE0AUolWBgiJK?=
 =?iso-8859-1?Q?offyn+BbKyR69e3eQPYFBKtAUzFfqw9lp2QusOGfB9MaRl6qM7TGaOHg3x?=
 =?iso-8859-1?Q?oWEATgY3YNals5n8IqymBj/jt2YZLrAI5yPdsd2gJYU/?=
Content-Type: text/plain; charset="iso-8859-1"
Content-ID: <69EE4CB1F6B8DF45B593FA40B59EECD4@HIDDEN>
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: radiofrance.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: PR0P264MB0425.FRAP264.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-Network-Message-Id: b4cff3e2-da60-4670-2bdf-08d8bfe6c1e3
X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jan 2021 21:35:08.7889 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 1d643b07-8cf5-4e2d-ad1e-86d6b948fc3b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: SVkCT04BH8E7Oy7MxTI9EMda5NS5POdgtEKmebBf6xr+G/eqEjW056NAehlPZFFUdDDeFgd6ufviX19+ijlEJ5i869l+qdQIAmeFpe+eOWn+bLgMkq8LhhXGgb/uRzYY
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR0P264MB0492
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737
 definitions=2021-01-23_12:2021-01-22,
 2021-01-23 signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0
 phishscore=0 clxscore=1011
 impostorscore=0 lowpriorityscore=0 mlxlogscore=999 spamscore=0 bulkscore=0
 adultscore=0 malwarescore=0 suspectscore=0 priorityscore=1501
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000
 definitions=main-2101230127
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 44178
X-Mailman-Approved-At: Sat, 23 Jan 2021 18:23:48 -0500
Cc: Katherine Cox-Buday <cox.katherine.e@HIDDEN>,
 =?iso-8859-1?Q?Ludovic_Court=E8s?= <ludo@HIDDEN>,
 Helio Machado <0x2b3bfa0@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

This patch add a `guix import go` command.

It was tested with several big repositories and seems to mostly work for
the import part (because building Guix packages is an other story). There
is still bugs blocking e.g. use of any k8s.io modules.

* guix/import/go.scm: Created Go Importer
* guix/scripts/import.scm: Created Go Importer Subcommand
* guix/import/go.scm (importers): Added Go Importer Subcommand

Signed-off-by: Francois Joulaud <francois.joulaud@HIDDEN>
---
The patch is a rebased and modified version of the one proposed by
Katherine Cox-Buday.

Notable modifications are=A0:
- move from (guix json) to (json)
- new parse-go.mod with no "set!" and parsing some go.mod which were in
  error before
- adding comments (maybe too much comments)
- renamed SCS to VCS to be in accordance with vocabulary in use in Guix
  and in Go worlds
- replacing escape-capital-letters by Helio Machado's go-path-escape
- no pruning of major version in go module names as they are considered
  as completely different artefacts by Go programmers
- fixed recursive-import probably broken by the rebase
- force usage of url-fetch from (guix build download)

I would be happy to hear about problems and perspective for this patch and
will now focus on my next step which is actually building any package.

Hope I CCed the right persons, I am not really aware of applicable
netiquette here.

Interdiff=A0:
  diff --git a/guix/import/go.scm b/guix/import/go.scm
  index 61009f3565..7f5f300f0a 100644
  --- a/guix/import/go.scm
  +++ b/guix/import/go.scm
  @@ -1,5 +1,7 @@
   ;;; GNU Guix --- Functional package management for GNU
   ;;; Copyright =A9 2020 Katherine Cox-Buday <cox.katherine.e@HIDDEN>
  +;;; Copyright =A9 2020 Helio Machado <0x2b3bfa0+guix@HIDDEN>
  +;;; Copyright =A9 2021 Fran=E7ois Joulaud <francois.joulaud@radiofrance.=
com>
   ;;;
   ;;; This file is part of GNU Guix.
   ;;;
  @@ -16,6 +18,21 @@
   ;;; You should have received a copy of the GNU General Public License
   ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
  =20
  +;;; (guix import golang) wants to make easier to create Guix package
  +;;; declaration for Go modules.
  +;;;
  +;;; Modules in Go are "collection of related Go packages" which are
  +;;; "the unit of source code interchange and versioning".
  +;;; Modules are generally hosted in a repository.
  +;;;
  +;;; At this point it should handle correctly modules which
  +;;; - have only Go dependencies;
  +;;; - use go.mod;
  +;;; - and are accessible from proxy.golang.org (or configured GOPROXY).
  +;;;
  +;;; We translate Go module paths  to a Guix package name under the
  +;;; assumption that there will be no collision.
  +
   (define-module (guix import go)
     #:use-module (ice-9 match)
     #:use-module (ice-9 rdelim)
  @@ -23,7 +40,7 @@
     #:use-module (ice-9 regex)
     #:use-module (srfi srfi-1)
     #:use-module (srfi srfi-9)
  -  #:use-module (guix json)
  +  #:use-module (json)
     #:use-module ((guix download) #:prefix download:)
     #:use-module (guix import utils)
     #:use-module (guix import json)
  @@ -33,88 +50,129 @@
     #:use-module ((guix licenses) #:prefix license:)
     #:use-module (guix base16)
     #:use-module (guix base32)
  -  #:use-module (guix build download)
  +  #:use-module ((guix build download) #:prefix build-download:)
     #:use-module (web uri)
  =20
     #:export (go-module->guix-package
               go-module-recursive-import
               infer-module-root))
  =20
  -(define (escape-capital-letters s)
  -  "To avoid ambiguity when serving from case-insensitive file systems, t=
he
  -$module and $version elements are case-encoded by replacing every upperc=
ase
  -letter with an exclamation mark followed by the corresponding lower-case
  -letter."
  -  (let ((escaped-string (string)))
  -    (string-for-each-index
  -     (lambda (i)
  -       (let ((c (string-ref s i)))
  -         (set! escaped-string
  -           (string-concatenate
  -            (list escaped-string
  -                  (if (char-upper-case? c) "!" "")
  -                  (string (char-downcase c)))))))
  -     s)
  -    escaped-string))
  +(define (go-path-escape path)
  +  "Escape a module path by replacing every uppercase letter with an excl=
amation
  +mark followed with its lowercase equivalent, as per the module Escaped P=
aths
  +specification. https://godoc.org/golang.org/x/mod/module#hdr-Escaped_Pat=
hs"
  +  (define (escape occurrence)
  +    (string-append "!" (string-downcase (match:substring occurrence))))
  +  (regexp-substitute/global #f "[A-Z]" path 'pre escape 'post))
  +
  =20
   (define (fetch-latest-version goproxy-url module-path)
     "Fetches the version number of the latest version for MODULE-PATH from=
 the
   given GOPROXY-URL server."
     (assoc-ref
      (json-fetch (format #f "~a/~a/@latest" goproxy-url
  -                       (escape-capital-letters module-path)))
  +                       (go-path-escape module-path)))
      "Version"))
  =20
   (define (fetch-go.mod goproxy-url module-path version file)
     "Fetches go.mod from the given GOPROXY-URL server for the given MODULE=
-PATH
   and VERSION."
  -  (url-fetch (format #f "~a/~a/@v/~a.mod" goproxy-url
  -                     (escape-capital-letters module-path)
  -                     (escape-capital-letters version))
  -             file
  -             #:print-build-trace? #f))
  +  (let ((url (format #f "~a/~a/@v/~a.mod" goproxy-url
  +                     (go-path-escape module-path)
  +                     (go-path-escape version))))
  +    (parameterize ((current-output-port (current-error-port)))
  +      (build-download:url-fetch url
  +                                file
  +                                #:print-build-trace? #f))))
  =20
   (define (parse-go.mod go.mod-path)
  -  "Parses a go.mod file and returns an alist of module path to version."
  +  "PARSE-GO.MOD takes a filename in GO.MOD-PATH and extract a list of
  +requirements from it."
  +  ;; We parse only a subset of https://golang.org/ref/mod#go-mod-file-gr=
ammar
  +  ;; which we think necessary for our use case.
  +  (define (toplevel results)
  +    "Main parser, RESULTS is a pair of alist serving as accumulator for
  +     all encountered requirements and replacements."
  +    (let ((line (read-line)))
  +      (cond
  +       ((eof-object? line)
  +        ;; parsing ended, give back the result
  +        results)
  +       ((string=3D? line "require (")
  +        ;; a require block begins, delegate parsing to IN-REQUIRE
  +        (in-require results))
  +       ((string-prefix? "require " line)
  +        ;; a require directive by itself
  +        (let* ((stripped-line (string-drop line 8))
  +               (new-results (require-directive results stripped-line)))
  +          (toplevel new-results)))
  +       ((string-prefix? "replace " line)
  +        ;; a replace directive by itself
  +        (let* ((stripped-line (string-drop line 8))
  +               (new-results (replace-directive results stripped-line)))
  +          (toplevel new-results)))
  +       (#t
  +        ;; unrecognised line, ignore silently
  +        (toplevel results)))))
  +  (define (in-require results)
  +    (let ((line (read-line)))
  +      (cond
  +       ((eof-object? line)
  +        ;; this should never happen here but we ignore silently
  +        results)
  +       ((string=3D? line ")")
  +        ;; end of block, coming back to toplevel
  +        (toplevel results))
  +       (#t
  +        (in-require (require-directive results line))))))
  +  (define (replace-directive results line)
  +    "Extract replaced modules and new requirements from replace directiv=
e
  +    in LINE and add to RESULTS."
  +    ;; ReplaceSpec =3D ModulePath [ Version ] "=3D>" FilePath newline
  +    ;;             | ModulePath [ Version ] "=3D>" ModulePath Version ne=
wline .
  +    (let* ((requirements (car results))
  +           (replaced (cdr results))
  +           (re (string-concatenate
  +                '("([^[:blank:]]+)([[:blank:]]+([^[:blank:]]+))?"
  +                  "[[:blank:]]+" "=3D>" "[[:blank:]]+"
  +                  "([^[:blank:]]+)([[:blank:]]+([^[:blank:]]+))?")))
  +           (match (string-match re line))
  +           (module-path (match:substring match 1))
  +           (version (match:substring match 3))
  +           (new-module-path (match:substring match 4))
  +           (new-version (match:substring match 6))
  +           (new-replaced (acons module-path version replaced))
  +           (new-requirements
  +            (if (string-match "^\\.?\\./" new-module-path)
  +                requirements
  +                (acons new-module-path new-version requirements))))
  +      (cons new-requirements new-replaced)))
  +  (define (require-directive results line)
  +    "Extract requirement from LINE and add it to RESULTS."
  +    (let* ((requirements (car results))
  +           (replaced (cdr results))
  +           ;; A line in a require directive is composed of a module path=
 and
  +           ;; a version separated by whitespace and an optionnal '//' co=
mment at
  +           ;; the end.
  +           (re (string-concatenate
  +                '("^[[:blank:]]*"
  +                  "([^[:blank:]]+)[[:blank:]]+([^[:blank:]]+)"
  +                  "([[:blank:]]+//.*)?")))
  +           (match (string-match re line))
  +           (module-path (match:substring match 1))
  +           (version (match:substring match 2)))
  +      (cons (acons module-path version requirements) replaced)))
     (with-input-from-file go.mod-path
       (lambda ()
  -      (let ((in-require? #f)
  -            (requirements (list)))
  -        (do ((line (read-line) (read-line)))
  -            ((eof-object? line))
  -          (set! line (string-trim line))
  -          ;; The parser is either entering, within, exiting, or after th=
e
  -          ;; require block. The Go toolchain is trustworthy so edge-case=
s like
  -          ;; double-entry, etc. need not complect the parser.
  -          (cond
  -           ((string=3D? line "require (")
  -            (set! in-require? #t))
  -           ((and in-require? (string=3D? line ")"))
  -            (set! in-require? #f))
  -           (in-require?
  -            (let* ((requirement (string-split line #\space))
  -                   ;; Modules should be unquoted
  -                   (module-path (string-delete #\" (car requirement)))
  -                   (version (list-ref requirement 1)))
  -              (set! requirements (acons module-path version requirements=
))))
  -           ((string-prefix? "replace" line)
  -            (let* ((requirement (string-split line #\space))
  -                   (module-path (list-ref requirement 1))
  -                   (new-module-path (list-ref requirement 3))
  -                   (version (list-ref requirement 4)))
  -              (set! requirements (assoc-remove! requirements module-path=
))
  -              (set! requirements (acons new-module-path version requirem=
ents))))))
  -        requirements))))
  -
  -(define (module-path-without-major-version module-path)
  -  "Go modules can be appended with a major version indicator,
  -e.g. /v3. Sometimes it is desirable to work with the root module path. F=
or
  -instance, for a module path github.com/foo/bar/v3 this function returns
  -github.com/foo/bar."
  -  (let ((m (string-match "(.*)\\/v[0-9]+$" module-path)))
  -    (if m
  -        (match:substring m 1)
  -        module-path)))
  +      (let* ((results (toplevel '(() . ())))
  +             (requirements (car results))
  +             (replaced (cdr results)))
  +        ;; At last we remove replaced modules from the requirements list
  +        (fold
  +         (lambda (replacedelem requirements)
  +             (alist-delete! (car replacedelem) requirements))
  +         requirements
  +         replaced)))))
  =20
   (define (infer-module-root module-path)
     "Go modules can be defined at any level of a repository's tree, but qu=
erying
  @@ -124,38 +182,42 @@ root path from its path. For a set of well-known fo=
rges, the pattern of what
   consists of a module's root page is known before hand."
     ;; See the following URL for the official Go equivalent:
     ;; https://github.com/golang/go/blob/846dce9d05f19a1f53465e62a304dea21=
b99f910/src/cmd/go/internal/vcs/vcs.go#L1026-L1087
  -  (define-record-type <scs>
  -    (make-scs url-prefix root-regex type)
  -    scs?
  -    (url-prefix	scs-url-prefix)
  -    (root-regex scs-root-regex)
  -    (type	scs-type))
  -  (let* ((known-scs
  +  ;;
  +  ;; FIXME: handle module path with VCS qualifier as described in
  +  ;; https://golang.org/ref/mod#vcs-find and
  +  ;; https://golang.org/cmd/go/#hdr-Remote_import_paths
  +  (define-record-type <vcs>
  +    (make-vcs url-prefix root-regex type)
  +    vcs?
  +    (url-prefix vcs-url-prefix)
  +    (root-regex vcs-root-regex)
  +    (type vcs-type))
  +  (let* ((known-vcs
             (list
  -           (make-scs
  +           (make-vcs
               "github.com"
               "^(github\\.com/[A-Za-z0-9_.\\-]+/[A-Za-z0-9_.\\-]+)(/[A-Za-=
z0-9_.\\-]+)*$"
               'git)
  -           (make-scs
  +           (make-vcs
               "bitbucket.org"
               "^(bitbucket\\.org/([A-Za-z0-9_.\\-]+/[A-Za-z0-9_.\\-]+))(/[=
A-Za-z0-9_.\\-]+)*$`"
               'unknown)
  -           (make-scs
  +           (make-vcs
               "hub.jazz.net/git/"
               "^(hub\\.jazz\\.net/git/[a-z0-9]+/[A-Za-z0-9_.\\-]+)(/[A-Za-=
z0-9_.\\-]+)*$"
               'git)
  -           (make-scs
  +           (make-vcs
               "git.apache.org"
               "^(git\\.apache\\.org/[a-z0-9_.\\-]+\\.git)(/[A-Za-z0-9_.\\-=
]+)*$"
               'git)
  -           (make-scs
  +           (make-vcs
               "git.openstack.org"
               "^(git\\.openstack\\.org/[A-Za-z0-9_.\\-]+/[A-Za-z0-9_.\\-]+=
)(\\.git)?(/[A-Za-z0-9_.\\-]+)*$"
               'git)))
  -         (scs (find (lambda (scs) (string-prefix? (scs-url-prefix scs) m=
odule-path))
  -                    known-scs)))
  -    (if scs
  -        (match:substring (string-match (scs-root-regex scs) module-path)=
 1)
  +         (vcs (find (lambda (vcs) (string-prefix? (vcs-url-prefix vcs) m=
odule-path))
  +                    known-vcs)))
  +    (if vcs
  +        (match:substring (string-match (vcs-root-regex vcs) module-path)=
 1)
           module-path)))
  =20
   (define (to-guix-package-name module-path)
  @@ -164,8 +226,7 @@ consists of a module's root page is known before hand=
."
      (string-append "go-"
                     (string-replace-substring
                      (string-replace-substring
  -                    ;; Guix has its own field for version
  -                    (module-path-without-major-version module-path)
  +                    module-path
                       "." "-")
                      "/" "-"))))
  =20
  @@ -173,7 +234,9 @@ consists of a module's root page is known before hand=
."
     "Fetches module meta-data from a module's landing page. This is necess=
ary
   because goproxy servers don't currently provide all the information need=
ed to
   build a package."
  -  (let* ((port (http-fetch (string->uri (format #f "https://~a?go-get=3D=
1" module-path))))
  +  ;; FIXME: This code breaks on k8s.io which have a meta tag splitted
  +  ;; on several lines
  +  (let* ((port (build-download:http-fetch (string->uri (format #f "https=
://~a?go-get=3D1" module-path))))
            (module-metadata #f)
            (meta-tag-prefix "<meta name=3D\"go-import\" content=3D\"")
            (meta-tag-prefix-length (string-length meta-tag-prefix)))
  @@ -185,7 +248,7 @@ build a package."
             (let* ((start (+ meta-tag-index meta-tag-prefix-length))
                    (end (string-index line #\" start)))
               (set! module-metadata
  -              (string-split (substring/shared line start end) #\space)))=
)))
  +                  (string-split (substring/shared line start end) #\spac=
e))))))
       (close-port port)
       module-metadata))
  =20
  @@ -244,7 +307,7 @@ control system is being used."
               (dependencies (map car (parse-go.mod temp)))
               (guix-name (to-guix-package-name module-path))
               (root-module-path (infer-module-root module-path))
  -            ;; SCS type and URL are not included in goproxy information.=
 For
  +            ;; VCS type and URL are not included in goproxy information.=
 For
               ;; this we need to fetch it from the official module page.
               (meta-data (fetch-module-meta-data root-module-path))
               (scs-type (module-meta-data-scs meta-data))
  @@ -268,9 +331,10 @@ control system is being used."
  =20
   (define* (go-module-recursive-import package-name
                                        #:key (goproxy-url "https://proxy.g=
olang.org"))
  -  (recursive-import package-name #f
  -                    #:repo->guix-package
  -                    (lambda (name _)
  -                      (go-module->guix-package name
  -                                               #:goproxy-url goproxy-url=
))
  -                    #:guix-name to-guix-package-name))
  +  (recursive-import
  +   package-name
  +   #:repo->guix-package (lambda* (name . _)
  +                          (go-module->guix-package
  +                           name
  +                           #:goproxy-url goproxy-url))
  +   #:guix-name to-guix-package-name))

 guix/import/go.scm         | 340 +++++++++++++++++++++++++++++++++++++
 guix/scripts/import.scm    |   2 +-
 guix/scripts/import/go.scm | 118 +++++++++++++
 3 files changed, 459 insertions(+), 1 deletion(-)
 create mode 100644 guix/import/go.scm
 create mode 100644 guix/scripts/import/go.scm

diff --git a/guix/import/go.scm b/guix/import/go.scm
new file mode 100644
index 0000000000..7f5f300f0a
--- /dev/null
+++ b/guix/import/go.scm
@@ -0,0 +1,340 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright =A9 2020 Katherine Cox-Buday <cox.katherine.e@HIDDEN>
+;;; Copyright =A9 2020 Helio Machado <0x2b3bfa0+guix@HIDDEN>
+;;; Copyright =A9 2021 Fran=E7ois Joulaud <francois.joulaud@HIDDEN=
m>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; (guix import golang) wants to make easier to create Guix package
+;;; declaration for Go modules.
+;;;
+;;; Modules in Go are "collection of related Go packages" which are
+;;; "the unit of source code interchange and versioning".
+;;; Modules are generally hosted in a repository.
+;;;
+;;; At this point it should handle correctly modules which
+;;; - have only Go dependencies;
+;;; - use go.mod;
+;;; - and are accessible from proxy.golang.org (or configured GOPROXY).
+;;;
+;;; We translate Go module paths  to a Guix package name under the
+;;; assumption that there will be no collision.
+
+(define-module (guix import go)
+  #:use-module (ice-9 match)
+  #:use-module (ice-9 rdelim)
+  #:use-module (ice-9 receive)
+  #:use-module (ice-9 regex)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-9)
+  #:use-module (json)
+  #:use-module ((guix download) #:prefix download:)
+  #:use-module (guix import utils)
+  #:use-module (guix import json)
+  #:use-module (guix packages)
+  #:use-module (guix upstream)
+  #:use-module (guix utils)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix base16)
+  #:use-module (guix base32)
+  #:use-module ((guix build download) #:prefix build-download:)
+  #:use-module (web uri)
+
+  #:export (go-module->guix-package
+            go-module-recursive-import
+            infer-module-root))
+
+(define (go-path-escape path)
+  "Escape a module path by replacing every uppercase letter with an exclam=
ation
+mark followed with its lowercase equivalent, as per the module Escaped Pat=
hs
+specification. https://godoc.org/golang.org/x/mod/module#hdr-Escaped_Paths=
"
+  (define (escape occurrence)
+    (string-append "!" (string-downcase (match:substring occurrence))))
+  (regexp-substitute/global #f "[A-Z]" path 'pre escape 'post))
+
+
+(define (fetch-latest-version goproxy-url module-path)
+  "Fetches the version number of the latest version for MODULE-PATH from t=
he
+given GOPROXY-URL server."
+  (assoc-ref
+   (json-fetch (format #f "~a/~a/@latest" goproxy-url
+                       (go-path-escape module-path)))
+   "Version"))
+
+(define (fetch-go.mod goproxy-url module-path version file)
+  "Fetches go.mod from the given GOPROXY-URL server for the given MODULE-P=
ATH
+and VERSION."
+  (let ((url (format #f "~a/~a/@v/~a.mod" goproxy-url
+                     (go-path-escape module-path)
+                     (go-path-escape version))))
+    (parameterize ((current-output-port (current-error-port)))
+      (build-download:url-fetch url
+                                file
+                                #:print-build-trace? #f))))
+
+(define (parse-go.mod go.mod-path)
+  "PARSE-GO.MOD takes a filename in GO.MOD-PATH and extract a list of
+requirements from it."
+  ;; We parse only a subset of https://golang.org/ref/mod#go-mod-file-gram=
mar
+  ;; which we think necessary for our use case.
+  (define (toplevel results)
+    "Main parser, RESULTS is a pair of alist serving as accumulator for
+     all encountered requirements and replacements."
+    (let ((line (read-line)))
+      (cond
+       ((eof-object? line)
+        ;; parsing ended, give back the result
+        results)
+       ((string=3D? line "require (")
+        ;; a require block begins, delegate parsing to IN-REQUIRE
+        (in-require results))
+       ((string-prefix? "require " line)
+        ;; a require directive by itself
+        (let* ((stripped-line (string-drop line 8))
+               (new-results (require-directive results stripped-line)))
+          (toplevel new-results)))
+       ((string-prefix? "replace " line)
+        ;; a replace directive by itself
+        (let* ((stripped-line (string-drop line 8))
+               (new-results (replace-directive results stripped-line)))
+          (toplevel new-results)))
+       (#t
+        ;; unrecognised line, ignore silently
+        (toplevel results)))))
+  (define (in-require results)
+    (let ((line (read-line)))
+      (cond
+       ((eof-object? line)
+        ;; this should never happen here but we ignore silently
+        results)
+       ((string=3D? line ")")
+        ;; end of block, coming back to toplevel
+        (toplevel results))
+       (#t
+        (in-require (require-directive results line))))))
+  (define (replace-directive results line)
+    "Extract replaced modules and new requirements from replace directive
+    in LINE and add to RESULTS."
+    ;; ReplaceSpec =3D ModulePath [ Version ] "=3D>" FilePath newline
+    ;;             | ModulePath [ Version ] "=3D>" ModulePath Version newl=
ine .
+    (let* ((requirements (car results))
+           (replaced (cdr results))
+           (re (string-concatenate
+                '("([^[:blank:]]+)([[:blank:]]+([^[:blank:]]+))?"
+                  "[[:blank:]]+" "=3D>" "[[:blank:]]+"
+                  "([^[:blank:]]+)([[:blank:]]+([^[:blank:]]+))?")))
+           (match (string-match re line))
+           (module-path (match:substring match 1))
+           (version (match:substring match 3))
+           (new-module-path (match:substring match 4))
+           (new-version (match:substring match 6))
+           (new-replaced (acons module-path version replaced))
+           (new-requirements
+            (if (string-match "^\\.?\\./" new-module-path)
+                requirements
+                (acons new-module-path new-version requirements))))
+      (cons new-requirements new-replaced)))
+  (define (require-directive results line)
+    "Extract requirement from LINE and add it to RESULTS."
+    (let* ((requirements (car results))
+           (replaced (cdr results))
+           ;; A line in a require directive is composed of a module path a=
nd
+           ;; a version separated by whitespace and an optionnal '//' comm=
ent at
+           ;; the end.
+           (re (string-concatenate
+                '("^[[:blank:]]*"
+                  "([^[:blank:]]+)[[:blank:]]+([^[:blank:]]+)"
+                  "([[:blank:]]+//.*)?")))
+           (match (string-match re line))
+           (module-path (match:substring match 1))
+           (version (match:substring match 2)))
+      (cons (acons module-path version requirements) replaced)))
+  (with-input-from-file go.mod-path
+    (lambda ()
+      (let* ((results (toplevel '(() . ())))
+             (requirements (car results))
+             (replaced (cdr results)))
+        ;; At last we remove replaced modules from the requirements list
+        (fold
+         (lambda (replacedelem requirements)
+             (alist-delete! (car replacedelem) requirements))
+         requirements
+         replaced)))))
+
+(define (infer-module-root module-path)
+  "Go modules can be defined at any level of a repository's tree, but quer=
ying
+for the meta tag usually can only be done at the webpage at the root of th=
e
+repository. Therefore, it is sometimes necessary to try and derive a modul=
e's
+root path from its path. For a set of well-known forges, the pattern of wh=
at
+consists of a module's root page is known before hand."
+  ;; See the following URL for the official Go equivalent:
+  ;; https://github.com/golang/go/blob/846dce9d05f19a1f53465e62a304dea21b9=
9f910/src/cmd/go/internal/vcs/vcs.go#L1026-L1087
+  ;;
+  ;; FIXME: handle module path with VCS qualifier as described in
+  ;; https://golang.org/ref/mod#vcs-find and
+  ;; https://golang.org/cmd/go/#hdr-Remote_import_paths
+  (define-record-type <vcs>
+    (make-vcs url-prefix root-regex type)
+    vcs?
+    (url-prefix vcs-url-prefix)
+    (root-regex vcs-root-regex)
+    (type vcs-type))
+  (let* ((known-vcs
+          (list
+           (make-vcs
+            "github.com"
+            "^(github\\.com/[A-Za-z0-9_.\\-]+/[A-Za-z0-9_.\\-]+)(/[A-Za-z0=
-9_.\\-]+)*$"
+            'git)
+           (make-vcs
+            "bitbucket.org"
+            "^(bitbucket\\.org/([A-Za-z0-9_.\\-]+/[A-Za-z0-9_.\\-]+))(/[A-=
Za-z0-9_.\\-]+)*$`"
+            'unknown)
+           (make-vcs
+            "hub.jazz.net/git/"
+            "^(hub\\.jazz\\.net/git/[a-z0-9]+/[A-Za-z0-9_.\\-]+)(/[A-Za-z0=
-9_.\\-]+)*$"
+            'git)
+           (make-vcs
+            "git.apache.org"
+            "^(git\\.apache\\.org/[a-z0-9_.\\-]+\\.git)(/[A-Za-z0-9_.\\-]+=
)*$"
+            'git)
+           (make-vcs
+            "git.openstack.org"
+            "^(git\\.openstack\\.org/[A-Za-z0-9_.\\-]+/[A-Za-z0-9_.\\-]+)(=
\\.git)?(/[A-Za-z0-9_.\\-]+)*$"
+            'git)))
+         (vcs (find (lambda (vcs) (string-prefix? (vcs-url-prefix vcs) mod=
ule-path))
+                    known-vcs)))
+    (if vcs
+        (match:substring (string-match (vcs-root-regex vcs) module-path) 1=
)
+        module-path)))
+
+(define (to-guix-package-name module-path)
+  "Converts a module's path to the canonical Guix format for Go packages."
+  (string-downcase
+   (string-append "go-"
+                  (string-replace-substring
+                   (string-replace-substring
+                    module-path
+                    "." "-")
+                   "/" "-"))))
+
+(define (fetch-module-meta-data module-path)
+  "Fetches module meta-data from a module's landing page. This is necessar=
y
+because goproxy servers don't currently provide all the information needed=
 to
+build a package."
+  ;; FIXME: This code breaks on k8s.io which have a meta tag splitted
+  ;; on several lines
+  (let* ((port (build-download:http-fetch (string->uri (format #f "https:/=
/~a?go-get=3D1" module-path))))
+         (module-metadata #f)
+         (meta-tag-prefix "<meta name=3D\"go-import\" content=3D\"")
+         (meta-tag-prefix-length (string-length meta-tag-prefix)))
+    (do ((line (read-line port) (read-line port)))
+        ((or (eof-object? line)
+             module-metadata))
+      (let ((meta-tag-index (string-contains line meta-tag-prefix)))
+        (when meta-tag-index
+          (let* ((start (+ meta-tag-index meta-tag-prefix-length))
+                 (end (string-index line #\" start)))
+            (set! module-metadata
+                  (string-split (substring/shared line start end) #\space)=
)))))
+    (close-port port)
+    module-metadata))
+
+(define (module-meta-data-scs meta-data)
+  "Return the source control system specified by a module's meta-data."
+  (string->symbol (list-ref meta-data 1)))
+
+(define (module-meta-data-repo-url meta-data goproxy-url)
+  "Return the URL where the fetcher which will be used can download the so=
urce
+control."
+  (if (member (module-meta-data-scs meta-data) '(fossil mod))
+      goproxy-url
+      (list-ref meta-data 2)))
+
+(define (source-uri scs-type scs-repo-url file)
+  "Generate the `origin' block of a package depending on what type of sour=
ce
+control system is being used."
+  (case scs-type
+    ((git)
+     `(origin
+        (method git-fetch)
+        (uri (git-reference
+              (url ,scs-repo-url)
+              (commit (string-append "v" version))))
+        (file-name (git-file-name name version))
+        (sha256
+         (base32
+          ,(guix-hash-url file)))))
+    ((hg)
+     `(origin
+        (method hg-fetch)
+        (uri (hg-reference
+              (url ,scs-repo-url)
+              (changeset ,version)))
+        (file-name (format #f "~a-~a-checkout" name version))))
+    ((svn)
+     `(origin
+        (method svn-fetch)
+        (uri (svn-reference
+              (url ,scs-repo-url)
+              (revision (string->number version))
+              (recursive? #f)))
+        (file-name (format #f "~a-~a-checkout" name version))
+        (sha256
+         (base32
+          ,(guix-hash-url file)))))
+    (else
+     (raise-exception (format #f "unsupported scs type: ~a" scs-type)))))
+
+(define* (go-module->guix-package module-path #:key (goproxy-url "https://=
proxy.golang.org"))
+  (call-with-temporary-output-file
+   (lambda (temp port)
+     (let* ((latest-version (fetch-latest-version goproxy-url module-path)=
)
+            (go.mod-path (fetch-go.mod goproxy-url module-path latest-vers=
ion
+                                       temp))
+            (dependencies (map car (parse-go.mod temp)))
+            (guix-name (to-guix-package-name module-path))
+            (root-module-path (infer-module-root module-path))
+            ;; VCS type and URL are not included in goproxy information. F=
or
+            ;; this we need to fetch it from the official module page.
+            (meta-data (fetch-module-meta-data root-module-path))
+            (scs-type (module-meta-data-scs meta-data))
+            (scs-repo-url (module-meta-data-repo-url meta-data goproxy-url=
)))
+       (values
+        `(package
+           (name ,guix-name)
+           ;; Elide the "v" prefix Go uses
+           (version ,(string-trim latest-version #\v))
+           (source
+            ,(source-uri scs-type scs-repo-url temp))
+           (build-system go-build-system)
+           ,@(maybe-inputs (map to-guix-package-name dependencies))
+           ;; TODO(katco): It would be nice to make an effort to fetch thi=
s
+           ;; from known forges, e.g. GitHub
+           (home-page ,(format #f "https://~a" root-module-path))
+           (synopsis "A Go package")
+           (description ,(format #f "~a is a Go package." guix-name))
+           (license #f))
+        dependencies)))))
+
+(define* (go-module-recursive-import package-name
+                                     #:key (goproxy-url "https://proxy.gol=
ang.org"))
+  (recursive-import
+   package-name
+   #:repo->guix-package (lambda* (name . _)
+                          (go-module->guix-package
+                           name
+                           #:goproxy-url goproxy-url))
+   #:guix-name to-guix-package-name))
diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm
index 0a3863f965..1d2b45d942 100644
--- a/guix/scripts/import.scm
+++ b/guix/scripts/import.scm
@@ -77,7 +77,7 @@ rather than \\n."
 ;;;
=20
 (define importers '("gnu" "nix" "pypi" "cpan" "hackage" "stackage" "elpa" =
"gem"
-                    "cran" "crate" "texlive" "json" "opam"))
+                    "go" "cran" "crate" "texlive" "json" "opam"))
=20
 (define (resolve-importer name)
   (let ((module (resolve-interface
diff --git a/guix/scripts/import/go.scm b/guix/scripts/import/go.scm
new file mode 100644
index 0000000000..fde7555973
--- /dev/null
+++ b/guix/scripts/import/go.scm
@@ -0,0 +1,118 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright =A9 2020 Katherine Cox-Buday <cox.katherine.e@HIDDEN>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix scripts import go)
+  #:use-module (guix ui)
+  #:use-module (guix utils)
+  #:use-module (guix scripts)
+  #:use-module (guix import go)
+  #:use-module (guix scripts import)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-11)
+  #:use-module (srfi srfi-37)
+  #:use-module (ice-9 match)
+  #:use-module (ice-9 format)
+  #:export (guix-import-go))
+
+
+;;;
+;;; Command-line options.
+;;;
+
+(define %default-options
+  '())
+
+(define (show-help)
+  (display (G_ "Usage: guix import go PACKAGE-PATH
+Import and convert the Go module for PACKAGE-PATH.\n"))
+  (display (G_ "
+  -h, --help             display this help and exit"))
+  (display (G_ "
+  -V, --version          display version information and exit"))
+  (display (G_ "
+  -r, --recursive        generate package expressions for all Go modules\
+ that are not yet in Guix"))
+  (display (G_ "
+  -p, --goproxy=3DGOPROXY  specify which goproxy server to use"))
+  (newline)
+  (show-bug-report-information))
+
+(define %options
+  ;; Specification of the command-line options.
+  (cons* (option '(#\h "help") #f #f
+                 (lambda args
+                   (show-help)
+                   (exit 0)))
+         (option '(#\V "version") #f #f
+                 (lambda args
+                   (show-version-and-exit "guix import go")))
+         (option '(#\r "recursive") #f #f
+                 (lambda (opt name arg result)
+                   (alist-cons 'recursive #t result)))
+         (option '(#\p "goproxy") #t #f
+                 (lambda (opt name arg result)
+                   (alist-cons 'goproxy
+                               (string->symbol arg)
+                               (alist-delete 'goproxy result))))
+         %standard-import-options))
+
+
+;;;
+;;; Entry point.
+;;;
+
+(define (guix-import-go . args)
+  (define (parse-options)
+    ;; Return the alist of option values.
+    (args-fold* args %options
+                (lambda (opt name arg result)
+                  (leave (G_ "~A: unrecognized option~%") name))
+                (lambda (arg result)
+                  (alist-cons 'argument arg result))
+                %default-options))
+
+  (let* ((opts (parse-options))
+         (args (filter-map (match-lambda
+                             (('argument . value)
+                              value)
+                             (_ #f))
+                           (reverse opts))))
+    (match args
+      ((module-name)
+       (if (assoc-ref opts 'recursive)
+           (map (match-lambda
+                  ((and ('package ('name name) . rest) pkg)
+                   `(define-public ,(string->symbol name)
+                      ,pkg))
+                  (_ #f))
+                (go-module-recursive-import module-name
+                                            #:goproxy-url
+                                            (or (assoc-ref opts 'goproxy)
+                                                "https://proxy.golang.org"=
)))
+           (let ((sexp (go-module->guix-package module-name
+                                                #:goproxy-url
+                                                (or (assoc-ref opts 'gopro=
xy)
+                                                    "https://proxy.golang.=
org"))))
+             (unless sexp
+               (leave (G_ "failed to download meta-data for module '~a'~%"=
)
+                      module-name))
+             sexp)))
+      (()
+       (leave (G_ "too few arguments~%")))
+      ((many ...)
+       (leave (G_ "too many arguments~%"))))))
--=20
2.28.0=




Information forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.

Message received at 44178 <at> debbugs.gnu.org:


Received: (at 44178) by debbugs.gnu.org; 23 Jan 2021 22:41:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 23 17:41:38 2021
Received: from localhost ([127.0.0.1]:35558 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l3Rb0-0007rf-1n
	for submit <at> debbugs.gnu.org; Sat, 23 Jan 2021 17:41:38 -0500
Received: from mail-io1-f43.google.com ([209.85.166.43]:33310)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <cox.katherine.e@HIDDEN>) id 1l3Rax-0007rR-9N
 for 44178 <at> debbugs.gnu.org; Sat, 23 Jan 2021 17:41:29 -0500
Received: by mail-io1-f43.google.com with SMTP id q129so19009727iod.0
 for <44178 <at> debbugs.gnu.org>; Sat, 23 Jan 2021 14:41:27 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=AfIQgd61Sh0kD6UzUU9JSc0rKkmRCaaBFD1ebOlxmbY=;
 b=gxEzTPMSm/IdJcxoS6huIgC2Xx1lQow/faxXqn05fPaXQeRj5pxB+/WIo8DdppzOdL
 tWChQjZ1cXdUxQrsb2CdpII7L3zghkbGAmogPuP0ZEnLz8I4UgwXdrs7ZmouBJ03Yxp6
 SlZjGN0lGjkM1awuMh5Q5+ExlwnrVhaiWuuTVopaiVTX4uT2NHVLIXWzmhnRp1cmtXnd
 OXwB3WRdWIrl4rWXWZUnoE9hHa68X98NZ1ytmAn5DUGT+kGQ3dS2kouJKcshXpdPRacQ
 s3T8u3hUkDFpvwkpFKhwip4eIsjtm69F4XQ9rVLuPkHW2BqWgGj2oQBz2X1oZJXFyOhU
 onKQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=AfIQgd61Sh0kD6UzUU9JSc0rKkmRCaaBFD1ebOlxmbY=;
 b=tdxCRjn168qfer+d+aOtI22gQwSUABlYpH1obqRcX+J9D5JwMCD5+P/0O11cVvsklb
 7kC0dgA8JNQmr8lYUKU9fR/8Mdr6RnRduxaaDMN9U1lbjIzGfKCw/+5twwsDkpoM5yAe
 ujjvdUS6ZF1FDLNxihQHTfBRpsJPSHSZGhdB1HCSsOVIdkIHiQeZEIFwIJkFnl/s+uqw
 C+Pj16zrIJ4ts41UAxoyXXiXq21XoTsKmvUv8x6lKGQGYVGn6rGqwkrSdavABtPMjQ2r
 eSaEcQMoTN6ILbgTZjknx3WPTyt99yFRgEUNbYvFfPNm+iqQQJfVtd3o4Rz+jfIj8x0P
 0TUg==
X-Gm-Message-State: AOAM532Q38fwWK76wuVoASpWGd4NHua1vihoG4HeXehU9gFwxmiy5OIr
 mYeP5C83jE/r/y+WfTK2aAM=
X-Google-Smtp-Source: ABdhPJwH0j51zZ4xfe52L9k6xwXb1ysRv9DBuw4UmFEh2AK46CrDeZYuhAJzEREPM+NxWG7u+qu8Gg==
X-Received: by 2002:a05:6e02:1c85:: with SMTP id
 w5mr4897234ill.253.1611441681068; 
 Sat, 23 Jan 2021 14:41:21 -0800 (PST)
Received: from washu-v4 (172-221-246-205.res.spectrum.com. [172.221.246.205])
 by smtp.gmail.com with ESMTPSA id
 b17sm9221685ilr.1.2021.01.23.14.41.19
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 23 Jan 2021 14:41:19 -0800 (PST)
From: Katherine Cox-Buday <cox.katherine.e@HIDDEN>
To: JOULAUD =?utf-8?Q?Fran=C3=A7ois?= <Francois.JOULAUD@HIDDEN>
Subject: Re: [PATCH] Create importer for Go modules
References: <20210123212742.m2thdeuzdvgpkgeo@HIDDEN>
Date: Sat, 23 Jan 2021 16:41:18 -0600
In-Reply-To: <20210123212742.m2thdeuzdvgpkgeo@HIDDEN>
 ("JOULAUD =?utf-8?Q?Fran=C3=A7ois=22's?= message of "Sat, 23 Jan 2021
 21:35:08 +0000")
Message-ID: <87r1mb6zu9.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 44178
Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>,
 "44178 <at> debbugs.gnu.org" <44178 <at> debbugs.gnu.org>,
 Helio Machado <0x2b3bfa0@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)

Thanks so much for the patches, Helio, Joulaud!

I apologize for the long delay before looking at this again. My time
right now is extremely limited due to COVID-19 related childcare and
activities. I was negligent and left a patch to bitrot on my
computer[1]. This patch supersedes it.

In addition to the things this patch corrects, I was/am working on a few
other bugs:

- There are valid Go Module paths which when queried will not serve the
  requisite meta tag. I had modified `fetch-module-meta-data` to
  recursively walk up the module path searching for a valid meta tag
  (see diff[1]).

- I think Joulaud's patch covers this, but replacements relative to a
  module are a possibility.

- For reasons Joulaud calls out, a simple line-parser of the HTML for a
  module is not sufficient. Since we are pulling pages down from the
  wider internet, we should fall back on a library made for parsing HTML
  so we handle any edge-cases (e.g. meta tags split across lines). I am
  currently looking at `sxml`, and if that doesn't pan out `htmlprag`

- Some module homepages issue HTTP redirects. Last time I tested this,
  `http-fetch` does not handle this properly.

I think that covers everything.

I have pushed everything (including Joulaud's patch with appropriate
attribution) here[2]. I am admittedly new at using email to organize
code changes, but using a forge seems easier.

[1] https://github.com/guix-mirror/guix/commit/cce35c6d68a9bddf9558e85d2cb8=
8be323da9247
[2] https://github.com/kat-co/guix/tree/create-go-importer

Can I suggest we coordinate there, or is that too much of an imposition?

-
Katherine

JOULAUD Fran=C3=A7ois <Francois.JOULAUD@HIDDEN> writes:

> This patch add a `guix import go` command.
>
> It was tested with several big repositories and seems to mostly work for
> the import part (because building Guix packages is an other story). There
> is still bugs blocking e.g. use of any k8s.io modules.
>
> * guix/import/go.scm: Created Go Importer
> * guix/scripts/import.scm: Created Go Importer Subcommand
> * guix/import/go.scm (importers): Added Go Importer Subcommand
>
> Signed-off-by: Francois Joulaud <francois.joulaud@HIDDEN>
> ---
> The patch is a rebased and modified version of the one proposed by
> Katherine Cox-Buday.
>
> Notable modifications are=C2=A0:
> - move from (guix json) to (json)
> - new parse-go.mod with no "set!" and parsing some go.mod which were in
>   error before
> - adding comments (maybe too much comments)
> - renamed SCS to VCS to be in accordance with vocabulary in use in Guix
>   and in Go worlds
> - replacing escape-capital-letters by Helio Machado's go-path-escape
> - no pruning of major version in go module names as they are considered
>   as completely different artefacts by Go programmers
> - fixed recursive-import probably broken by the rebase
> - force usage of url-fetch from (guix build download)
>
> I would be happy to hear about problems and perspective for this patch and
> will now focus on my next step which is actually building any package.
>
> Hope I CCed the right persons, I am not really aware of applicable
> netiquette here.
>
> Interdiff=C2=A0:
>   diff --git a/guix/import/go.scm b/guix/import/go.scm
>   index 61009f3565..7f5f300f0a 100644
>   --- a/guix/import/go.scm
>   +++ b/guix/import/go.scm
>   @@ -1,5 +1,7 @@
>    ;;; GNU Guix --- Functional package management for GNU
>    ;;; Copyright =C2=A9 2020 Katherine Cox-Buday <cox.katherine.e@HIDDEN=
om>
>   +;;; Copyright =C2=A9 2020 Helio Machado <0x2b3bfa0+guix@HIDDEN>
>   +;;; Copyright =C2=A9 2021 Fran=C3=A7ois Joulaud <francois.joulaud@radi=
ofrance.com>
>    ;;;
>    ;;; This file is part of GNU Guix.
>    ;;;
>   @@ -16,6 +18,21 @@
>    ;;; You should have received a copy of the GNU General Public License
>    ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
>=20=20=20=20
>   +;;; (guix import golang) wants to make easier to create Guix package
>   +;;; declaration for Go modules.
>   +;;;
>   +;;; Modules in Go are "collection of related Go packages" which are
>   +;;; "the unit of source code interchange and versioning".
>   +;;; Modules are generally hosted in a repository.
>   +;;;
>   +;;; At this point it should handle correctly modules which
>   +;;; - have only Go dependencies;
>   +;;; - use go.mod;
>   +;;; - and are accessible from proxy.golang.org (or configured GOPROXY).
>   +;;;
>   +;;; We translate Go module paths  to a Guix package name under the
>   +;;; assumption that there will be no collision.
>   +
>    (define-module (guix import go)
>      #:use-module (ice-9 match)
>      #:use-module (ice-9 rdelim)
>   @@ -23,7 +40,7 @@
>      #:use-module (ice-9 regex)
>      #:use-module (srfi srfi-1)
>      #:use-module (srfi srfi-9)
>   -  #:use-module (guix json)
>   +  #:use-module (json)
>      #:use-module ((guix download) #:prefix download:)
>      #:use-module (guix import utils)
>      #:use-module (guix import json)
>   @@ -33,88 +50,129 @@
>      #:use-module ((guix licenses) #:prefix license:)
>      #:use-module (guix base16)
>      #:use-module (guix base32)
>   -  #:use-module (guix build download)
>   +  #:use-module ((guix build download) #:prefix build-download:)
>      #:use-module (web uri)
>=20=20=20=20
>      #:export (go-module->guix-package
>                go-module-recursive-import
>                infer-module-root))
>=20=20=20=20
>   -(define (escape-capital-letters s)
>   -  "To avoid ambiguity when serving from case-insensitive file systems,=
 the
>   -$module and $version elements are case-encoded by replacing every uppe=
rcase
>   -letter with an exclamation mark followed by the corresponding lower-ca=
se
>   -letter."
>   -  (let ((escaped-string (string)))
>   -    (string-for-each-index
>   -     (lambda (i)
>   -       (let ((c (string-ref s i)))
>   -         (set! escaped-string
>   -           (string-concatenate
>   -            (list escaped-string
>   -                  (if (char-upper-case? c) "!" "")
>   -                  (string (char-downcase c)))))))
>   -     s)
>   -    escaped-string))
>   +(define (go-path-escape path)
>   +  "Escape a module path by replacing every uppercase letter with an ex=
clamation
>   +mark followed with its lowercase equivalent, as per the module Escaped=
 Paths
>   +specification. https://godoc.org/golang.org/x/mod/module#hdr-Escaped_P=
aths"
>   +  (define (escape occurrence)
>   +    (string-append "!" (string-downcase (match:substring occurrence))))
>   +  (regexp-substitute/global #f "[A-Z]" path 'pre escape 'post))
>   +
>=20=20=20=20
>    (define (fetch-latest-version goproxy-url module-path)
>      "Fetches the version number of the latest version for MODULE-PATH fr=
om the
>    given GOPROXY-URL server."
>      (assoc-ref
>       (json-fetch (format #f "~a/~a/@latest" goproxy-url
>   -                       (escape-capital-letters module-path)))
>   +                       (go-path-escape module-path)))
>       "Version"))
>=20=20=20=20
>    (define (fetch-go.mod goproxy-url module-path version file)
>      "Fetches go.mod from the given GOPROXY-URL server for the given MODU=
LE-PATH
>    and VERSION."
>   -  (url-fetch (format #f "~a/~a/@v/~a.mod" goproxy-url
>   -                     (escape-capital-letters module-path)
>   -                     (escape-capital-letters version))
>   -             file
>   -             #:print-build-trace? #f))
>   +  (let ((url (format #f "~a/~a/@v/~a.mod" goproxy-url
>   +                     (go-path-escape module-path)
>   +                     (go-path-escape version))))
>   +    (parameterize ((current-output-port (current-error-port)))
>   +      (build-download:url-fetch url
>   +                                file
>   +                                #:print-build-trace? #f))))
>=20=20=20=20
>    (define (parse-go.mod go.mod-path)
>   -  "Parses a go.mod file and returns an alist of module path to version=
."
>   +  "PARSE-GO.MOD takes a filename in GO.MOD-PATH and extract a list of
>   +requirements from it."
>   +  ;; We parse only a subset of https://golang.org/ref/mod#go-mod-file-=
grammar
>   +  ;; which we think necessary for our use case.
>   +  (define (toplevel results)
>   +    "Main parser, RESULTS is a pair of alist serving as accumulator for
>   +     all encountered requirements and replacements."
>   +    (let ((line (read-line)))
>   +      (cond
>   +       ((eof-object? line)
>   +        ;; parsing ended, give back the result
>   +        results)
>   +       ((string=3D? line "require (")
>   +        ;; a require block begins, delegate parsing to IN-REQUIRE
>   +        (in-require results))
>   +       ((string-prefix? "require " line)
>   +        ;; a require directive by itself
>   +        (let* ((stripped-line (string-drop line 8))
>   +               (new-results (require-directive results stripped-line)))
>   +          (toplevel new-results)))
>   +       ((string-prefix? "replace " line)
>   +        ;; a replace directive by itself
>   +        (let* ((stripped-line (string-drop line 8))
>   +               (new-results (replace-directive results stripped-line)))
>   +          (toplevel new-results)))
>   +       (#t
>   +        ;; unrecognised line, ignore silently
>   +        (toplevel results)))))
>   +  (define (in-require results)
>   +    (let ((line (read-line)))
>   +      (cond
>   +       ((eof-object? line)
>   +        ;; this should never happen here but we ignore silently
>   +        results)
>   +       ((string=3D? line ")")
>   +        ;; end of block, coming back to toplevel
>   +        (toplevel results))
>   +       (#t
>   +        (in-require (require-directive results line))))))
>   +  (define (replace-directive results line)
>   +    "Extract replaced modules and new requirements from replace direct=
ive
>   +    in LINE and add to RESULTS."
>   +    ;; ReplaceSpec =3D ModulePath [ Version ] "=3D>" FilePath newline
>   +    ;;             | ModulePath [ Version ] "=3D>" ModulePath Version =
newline .
>   +    (let* ((requirements (car results))
>   +           (replaced (cdr results))
>   +           (re (string-concatenate
>   +                '("([^[:blank:]]+)([[:blank:]]+([^[:blank:]]+))?"
>   +                  "[[:blank:]]+" "=3D>" "[[:blank:]]+"
>   +                  "([^[:blank:]]+)([[:blank:]]+([^[:blank:]]+))?")))
>   +           (match (string-match re line))
>   +           (module-path (match:substring match 1))
>   +           (version (match:substring match 3))
>   +           (new-module-path (match:substring match 4))
>   +           (new-version (match:substring match 6))
>   +           (new-replaced (acons module-path version replaced))
>   +           (new-requirements
>   +            (if (string-match "^\\.?\\./" new-module-path)
>   +                requirements
>   +                (acons new-module-path new-version requirements))))
>   +      (cons new-requirements new-replaced)))
>   +  (define (require-directive results line)
>   +    "Extract requirement from LINE and add it to RESULTS."
>   +    (let* ((requirements (car results))
>   +           (replaced (cdr results))
>   +           ;; A line in a require directive is composed of a module pa=
th and
>   +           ;; a version separated by whitespace and an optionnal '//' =
comment at
>   +           ;; the end.
>   +           (re (string-concatenate
>   +                '("^[[:blank:]]*"
>   +                  "([^[:blank:]]+)[[:blank:]]+([^[:blank:]]+)"
>   +                  "([[:blank:]]+//.*)?")))
>   +           (match (string-match re line))
>   +           (module-path (match:substring match 1))
>   +           (version (match:substring match 2)))
>   +      (cons (acons module-path version requirements) replaced)))
>      (with-input-from-file go.mod-path
>        (lambda ()
>   -      (let ((in-require? #f)
>   -            (requirements (list)))
>   -        (do ((line (read-line) (read-line)))
>   -            ((eof-object? line))
>   -          (set! line (string-trim line))
>   -          ;; The parser is either entering, within, exiting, or after =
the
>   -          ;; require block. The Go toolchain is trustworthy so edge-ca=
ses like
>   -          ;; double-entry, etc. need not complect the parser.
>   -          (cond
>   -           ((string=3D? line "require (")
>   -            (set! in-require? #t))
>   -           ((and in-require? (string=3D? line ")"))
>   -            (set! in-require? #f))
>   -           (in-require?
>   -            (let* ((requirement (string-split line #\space))
>   -                   ;; Modules should be unquoted
>   -                   (module-path (string-delete #\" (car requirement)))
>   -                   (version (list-ref requirement 1)))
>   -              (set! requirements (acons module-path version requiremen=
ts))))
>   -           ((string-prefix? "replace" line)
>   -            (let* ((requirement (string-split line #\space))
>   -                   (module-path (list-ref requirement 1))
>   -                   (new-module-path (list-ref requirement 3))
>   -                   (version (list-ref requirement 4)))
>   -              (set! requirements (assoc-remove! requirements module-pa=
th))
>   -              (set! requirements (acons new-module-path version requir=
ements))))))
>   -        requirements))))
>   -
>   -(define (module-path-without-major-version module-path)
>   -  "Go modules can be appended with a major version indicator,
>   -e.g. /v3. Sometimes it is desirable to work with the root module path.=
 For
>   -instance, for a module path github.com/foo/bar/v3 this function returns
>   -github.com/foo/bar."
>   -  (let ((m (string-match "(.*)\\/v[0-9]+$" module-path)))
>   -    (if m
>   -        (match:substring m 1)
>   -        module-path)))
>   +      (let* ((results (toplevel '(() . ())))
>   +             (requirements (car results))
>   +             (replaced (cdr results)))
>   +        ;; At last we remove replaced modules from the requirements li=
st
>   +        (fold
>   +         (lambda (replacedelem requirements)
>   +             (alist-delete! (car replacedelem) requirements))
>   +         requirements
>   +         replaced)))))
>=20=20=20=20
>    (define (infer-module-root module-path)
>      "Go modules can be defined at any level of a repository's tree, but =
querying
>   @@ -124,38 +182,42 @@ root path from its path. For a set of well-known =
forges, the pattern of what
>    consists of a module's root page is known before hand."
>      ;; See the following URL for the official Go equivalent:
>      ;; https://github.com/golang/go/blob/846dce9d05f19a1f53465e62a304dea=
21b99f910/src/cmd/go/internal/vcs/vcs.go#L1026-L1087
>   -  (define-record-type <scs>
>   -    (make-scs url-prefix root-regex type)
>   -    scs?
>   -    (url-prefix	scs-url-prefix)
>   -    (root-regex scs-root-regex)
>   -    (type	scs-type))
>   -  (let* ((known-scs
>   +  ;;
>   +  ;; FIXME: handle module path with VCS qualifier as described in
>   +  ;; https://golang.org/ref/mod#vcs-find and
>   +  ;; https://golang.org/cmd/go/#hdr-Remote_import_paths
>   +  (define-record-type <vcs>
>   +    (make-vcs url-prefix root-regex type)
>   +    vcs?
>   +    (url-prefix vcs-url-prefix)
>   +    (root-regex vcs-root-regex)
>   +    (type vcs-type))
>   +  (let* ((known-vcs
>              (list
>   -           (make-scs
>   +           (make-vcs
>                "github.com"
>                "^(github\\.com/[A-Za-z0-9_.\\-]+/[A-Za-z0-9_.\\-]+)(/[A-Z=
a-z0-9_.\\-]+)*$"
>                'git)
>   -           (make-scs
>   +           (make-vcs
>                "bitbucket.org"
>                "^(bitbucket\\.org/([A-Za-z0-9_.\\-]+/[A-Za-z0-9_.\\-]+))(=
/[A-Za-z0-9_.\\-]+)*$`"
>                'unknown)
>   -           (make-scs
>   +           (make-vcs
>                "hub.jazz.net/git/"
>                "^(hub\\.jazz\\.net/git/[a-z0-9]+/[A-Za-z0-9_.\\-]+)(/[A-Z=
a-z0-9_.\\-]+)*$"
>                'git)
>   -           (make-scs
>   +           (make-vcs
>                "git.apache.org"
>                "^(git\\.apache\\.org/[a-z0-9_.\\-]+\\.git)(/[A-Za-z0-9_.\=
\-]+)*$"
>                'git)
>   -           (make-scs
>   +           (make-vcs
>                "git.openstack.org"
>                "^(git\\.openstack\\.org/[A-Za-z0-9_.\\-]+/[A-Za-z0-9_.\\-=
]+)(\\.git)?(/[A-Za-z0-9_.\\-]+)*$"
>                'git)))
>   -         (scs (find (lambda (scs) (string-prefix? (scs-url-prefix scs)=
 module-path))
>   -                    known-scs)))
>   -    (if scs
>   -        (match:substring (string-match (scs-root-regex scs) module-pat=
h) 1)
>   +         (vcs (find (lambda (vcs) (string-prefix? (vcs-url-prefix vcs)=
 module-path))
>   +                    known-vcs)))
>   +    (if vcs
>   +        (match:substring (string-match (vcs-root-regex vcs) module-pat=
h) 1)
>            module-path)))
>=20=20=20=20
>    (define (to-guix-package-name module-path)
>   @@ -164,8 +226,7 @@ consists of a module's root page is known before ha=
nd."
>       (string-append "go-"
>                      (string-replace-substring
>                       (string-replace-substring
>   -                    ;; Guix has its own field for version
>   -                    (module-path-without-major-version module-path)
>   +                    module-path
>                        "." "-")
>                       "/" "-"))))
>=20=20=20=20
>   @@ -173,7 +234,9 @@ consists of a module's root page is known before ha=
nd."
>      "Fetches module meta-data from a module's landing page. This is nece=
ssary
>    because goproxy servers don't currently provide all the information ne=
eded to
>    build a package."
>   -  (let* ((port (http-fetch (string->uri (format #f "https://~a?go-get=
=3D1" module-path))))
>   +  ;; FIXME: This code breaks on k8s.io which have a meta tag splitted
>   +  ;; on several lines
>   +  (let* ((port (build-download:http-fetch (string->uri (format #f "htt=
ps://~a?go-get=3D1" module-path))))
>             (module-metadata #f)
>             (meta-tag-prefix "<meta name=3D\"go-import\" content=3D\"")
>             (meta-tag-prefix-length (string-length meta-tag-prefix)))
>   @@ -185,7 +248,7 @@ build a package."
>              (let* ((start (+ meta-tag-index meta-tag-prefix-length))
>                     (end (string-index line #\" start)))
>                (set! module-metadata
>   -              (string-split (substring/shared line start end) #\space)=
)))))
>   +                  (string-split (substring/shared line start end) #\sp=
ace))))))
>        (close-port port)
>        module-metadata))
>=20=20=20=20
>   @@ -244,7 +307,7 @@ control system is being used."
>                (dependencies (map car (parse-go.mod temp)))
>                (guix-name (to-guix-package-name module-path))
>                (root-module-path (infer-module-root module-path))
>   -            ;; SCS type and URL are not included in goproxy informatio=
n. For
>   +            ;; VCS type and URL are not included in goproxy informatio=
n. For
>                ;; this we need to fetch it from the official module page.
>                (meta-data (fetch-module-meta-data root-module-path))
>                (scs-type (module-meta-data-scs meta-data))
>   @@ -268,9 +331,10 @@ control system is being used."
>=20=20=20=20
>    (define* (go-module-recursive-import package-name
>                                         #:key (goproxy-url "https://proxy=
.golang.org"))
>   -  (recursive-import package-name #f
>   -                    #:repo->guix-package
>   -                    (lambda (name _)
>   -                      (go-module->guix-package name
>   -                                               #:goproxy-url goproxy-u=
rl))
>   -                    #:guix-name to-guix-package-name))
>   +  (recursive-import
>   +   package-name
>   +   #:repo->guix-package (lambda* (name . _)
>   +                          (go-module->guix-package
>   +                           name
>   +                           #:goproxy-url goproxy-url))
>   +   #:guix-name to-guix-package-name))
>
>  guix/import/go.scm         | 340 +++++++++++++++++++++++++++++++++++++
>  guix/scripts/import.scm    |   2 +-
>  guix/scripts/import/go.scm | 118 +++++++++++++
>  3 files changed, 459 insertions(+), 1 deletion(-)
>  create mode 100644 guix/import/go.scm
>  create mode 100644 guix/scripts/import/go.scm
>
> diff --git a/guix/import/go.scm b/guix/import/go.scm
> new file mode 100644
> index 0000000000..7f5f300f0a
> --- /dev/null
> +++ b/guix/import/go.scm
> @@ -0,0 +1,340 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright =C2=A9 2020 Katherine Cox-Buday <cox.katherine.e@HIDDEN>
> +;;; Copyright =C2=A9 2020 Helio Machado <0x2b3bfa0+guix@HIDDEN>
> +;;; Copyright =C2=A9 2021 Fran=C3=A7ois Joulaud <francois.joulaud@radiof=
rance.com>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify it
> +;;; under the terms of the GNU General Public License as published by
> +;;; the Free Software Foundation; either version 3 of the License, or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public License
> +;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
> +
> +;;; (guix import golang) wants to make easier to create Guix package
> +;;; declaration for Go modules.
> +;;;
> +;;; Modules in Go are "collection of related Go packages" which are
> +;;; "the unit of source code interchange and versioning".
> +;;; Modules are generally hosted in a repository.
> +;;;
> +;;; At this point it should handle correctly modules which
> +;;; - have only Go dependencies;
> +;;; - use go.mod;
> +;;; - and are accessible from proxy.golang.org (or configured GOPROXY).
> +;;;
> +;;; We translate Go module paths  to a Guix package name under the
> +;;; assumption that there will be no collision.
> +
> +(define-module (guix import go)
> +  #:use-module (ice-9 match)
> +  #:use-module (ice-9 rdelim)
> +  #:use-module (ice-9 receive)
> +  #:use-module (ice-9 regex)
> +  #:use-module (srfi srfi-1)
> +  #:use-module (srfi srfi-9)
> +  #:use-module (json)
> +  #:use-module ((guix download) #:prefix download:)
> +  #:use-module (guix import utils)
> +  #:use-module (guix import json)
> +  #:use-module (guix packages)
> +  #:use-module (guix upstream)
> +  #:use-module (guix utils)
> +  #:use-module ((guix licenses) #:prefix license:)
> +  #:use-module (guix base16)
> +  #:use-module (guix base32)
> +  #:use-module ((guix build download) #:prefix build-download:)
> +  #:use-module (web uri)
> +
> +  #:export (go-module->guix-package
> +            go-module-recursive-import
> +            infer-module-root))
> +
> +(define (go-path-escape path)
> +  "Escape a module path by replacing every uppercase letter with an excl=
amation
> +mark followed with its lowercase equivalent, as per the module Escaped P=
aths
> +specification. https://godoc.org/golang.org/x/mod/module#hdr-Escaped_Pat=
hs"
> +  (define (escape occurrence)
> +    (string-append "!" (string-downcase (match:substring occurrence))))
> +  (regexp-substitute/global #f "[A-Z]" path 'pre escape 'post))
> +
> +
> +(define (fetch-latest-version goproxy-url module-path)
> +  "Fetches the version number of the latest version for MODULE-PATH from=
 the
> +given GOPROXY-URL server."
> +  (assoc-ref
> +   (json-fetch (format #f "~a/~a/@latest" goproxy-url
> +                       (go-path-escape module-path)))
> +   "Version"))
> +
> +(define (fetch-go.mod goproxy-url module-path version file)
> +  "Fetches go.mod from the given GOPROXY-URL server for the given MODULE=
-PATH
> +and VERSION."
> +  (let ((url (format #f "~a/~a/@v/~a.mod" goproxy-url
> +                     (go-path-escape module-path)
> +                     (go-path-escape version))))
> +    (parameterize ((current-output-port (current-error-port)))
> +      (build-download:url-fetch url
> +                                file
> +                                #:print-build-trace? #f))))
> +
> +(define (parse-go.mod go.mod-path)
> +  "PARSE-GO.MOD takes a filename in GO.MOD-PATH and extract a list of
> +requirements from it."
> +  ;; We parse only a subset of https://golang.org/ref/mod#go-mod-file-gr=
ammar
> +  ;; which we think necessary for our use case.
> +  (define (toplevel results)
> +    "Main parser, RESULTS is a pair of alist serving as accumulator for
> +     all encountered requirements and replacements."
> +    (let ((line (read-line)))
> +      (cond
> +       ((eof-object? line)
> +        ;; parsing ended, give back the result
> +        results)
> +       ((string=3D? line "require (")
> +        ;; a require block begins, delegate parsing to IN-REQUIRE
> +        (in-require results))
> +       ((string-prefix? "require " line)
> +        ;; a require directive by itself
> +        (let* ((stripped-line (string-drop line 8))
> +               (new-results (require-directive results stripped-line)))
> +          (toplevel new-results)))
> +       ((string-prefix? "replace " line)
> +        ;; a replace directive by itself
> +        (let* ((stripped-line (string-drop line 8))
> +               (new-results (replace-directive results stripped-line)))
> +          (toplevel new-results)))
> +       (#t
> +        ;; unrecognised line, ignore silently
> +        (toplevel results)))))
> +  (define (in-require results)
> +    (let ((line (read-line)))
> +      (cond
> +       ((eof-object? line)
> +        ;; this should never happen here but we ignore silently
> +        results)
> +       ((string=3D? line ")")
> +        ;; end of block, coming back to toplevel
> +        (toplevel results))
> +       (#t
> +        (in-require (require-directive results line))))))
> +  (define (replace-directive results line)
> +    "Extract replaced modules and new requirements from replace directive
> +    in LINE and add to RESULTS."
> +    ;; ReplaceSpec =3D ModulePath [ Version ] "=3D>" FilePath newline
> +    ;;             | ModulePath [ Version ] "=3D>" ModulePath Version ne=
wline .
> +    (let* ((requirements (car results))
> +           (replaced (cdr results))
> +           (re (string-concatenate
> +                '("([^[:blank:]]+)([[:blank:]]+([^[:blank:]]+))?"
> +                  "[[:blank:]]+" "=3D>" "[[:blank:]]+"
> +                  "([^[:blank:]]+)([[:blank:]]+([^[:blank:]]+))?")))
> +           (match (string-match re line))
> +           (module-path (match:substring match 1))
> +           (version (match:substring match 3))
> +           (new-module-path (match:substring match 4))
> +           (new-version (match:substring match 6))
> +           (new-replaced (acons module-path version replaced))
> +           (new-requirements
> +            (if (string-match "^\\.?\\./" new-module-path)
> +                requirements
> +                (acons new-module-path new-version requirements))))
> +      (cons new-requirements new-replaced)))
> +  (define (require-directive results line)
> +    "Extract requirement from LINE and add it to RESULTS."
> +    (let* ((requirements (car results))
> +           (replaced (cdr results))
> +           ;; A line in a require directive is composed of a module path=
 and
> +           ;; a version separated by whitespace and an optionnal '//' co=
mment at
> +           ;; the end.
> +           (re (string-concatenate
> +                '("^[[:blank:]]*"
> +                  "([^[:blank:]]+)[[:blank:]]+([^[:blank:]]+)"
> +                  "([[:blank:]]+//.*)?")))
> +           (match (string-match re line))
> +           (module-path (match:substring match 1))
> +           (version (match:substring match 2)))
> +      (cons (acons module-path version requirements) replaced)))
> +  (with-input-from-file go.mod-path
> +    (lambda ()
> +      (let* ((results (toplevel '(() . ())))
> +             (requirements (car results))
> +             (replaced (cdr results)))
> +        ;; At last we remove replaced modules from the requirements list
> +        (fold
> +         (lambda (replacedelem requirements)
> +             (alist-delete! (car replacedelem) requirements))
> +         requirements
> +         replaced)))))
> +
> +(define (infer-module-root module-path)
> +  "Go modules can be defined at any level of a repository's tree, but qu=
erying
> +for the meta tag usually can only be done at the webpage at the root of =
the
> +repository. Therefore, it is sometimes necessary to try and derive a mod=
ule's
> +root path from its path. For a set of well-known forges, the pattern of =
what
> +consists of a module's root page is known before hand."
> +  ;; See the following URL for the official Go equivalent:
> +  ;; https://github.com/golang/go/blob/846dce9d05f19a1f53465e62a304dea21=
b99f910/src/cmd/go/internal/vcs/vcs.go#L1026-L1087
> +  ;;
> +  ;; FIXME: handle module path with VCS qualifier as described in
> +  ;; https://golang.org/ref/mod#vcs-find and
> +  ;; https://golang.org/cmd/go/#hdr-Remote_import_paths
> +  (define-record-type <vcs>
> +    (make-vcs url-prefix root-regex type)
> +    vcs?
> +    (url-prefix vcs-url-prefix)
> +    (root-regex vcs-root-regex)
> +    (type vcs-type))
> +  (let* ((known-vcs
> +          (list
> +           (make-vcs
> +            "github.com"
> +            "^(github\\.com/[A-Za-z0-9_.\\-]+/[A-Za-z0-9_.\\-]+)(/[A-Za-=
z0-9_.\\-]+)*$"
> +            'git)
> +           (make-vcs
> +            "bitbucket.org"
> +            "^(bitbucket\\.org/([A-Za-z0-9_.\\-]+/[A-Za-z0-9_.\\-]+))(/[=
A-Za-z0-9_.\\-]+)*$`"
> +            'unknown)
> +           (make-vcs
> +            "hub.jazz.net/git/"
> +            "^(hub\\.jazz\\.net/git/[a-z0-9]+/[A-Za-z0-9_.\\-]+)(/[A-Za-=
z0-9_.\\-]+)*$"
> +            'git)
> +           (make-vcs
> +            "git.apache.org"
> +            "^(git\\.apache\\.org/[a-z0-9_.\\-]+\\.git)(/[A-Za-z0-9_.\\-=
]+)*$"
> +            'git)
> +           (make-vcs
> +            "git.openstack.org"
> +            "^(git\\.openstack\\.org/[A-Za-z0-9_.\\-]+/[A-Za-z0-9_.\\-]+=
)(\\.git)?(/[A-Za-z0-9_.\\-]+)*$"
> +            'git)))
> +         (vcs (find (lambda (vcs) (string-prefix? (vcs-url-prefix vcs) m=
odule-path))
> +                    known-vcs)))
> +    (if vcs
> +        (match:substring (string-match (vcs-root-regex vcs) module-path)=
 1)
> +        module-path)))
> +
> +(define (to-guix-package-name module-path)
> +  "Converts a module's path to the canonical Guix format for Go packages=
."
> +  (string-downcase
> +   (string-append "go-"
> +                  (string-replace-substring
> +                   (string-replace-substring
> +                    module-path
> +                    "." "-")
> +                   "/" "-"))))
> +
> +(define (fetch-module-meta-data module-path)
> +  "Fetches module meta-data from a module's landing page. This is necess=
ary
> +because goproxy servers don't currently provide all the information need=
ed to
> +build a package."
> +  ;; FIXME: This code breaks on k8s.io which have a meta tag splitted
> +  ;; on several lines
> +  (let* ((port (build-download:http-fetch (string->uri (format #f "https=
://~a?go-get=3D1" module-path))))
> +         (module-metadata #f)
> +         (meta-tag-prefix "<meta name=3D\"go-import\" content=3D\"")
> +         (meta-tag-prefix-length (string-length meta-tag-prefix)))
> +    (do ((line (read-line port) (read-line port)))
> +        ((or (eof-object? line)
> +             module-metadata))
> +      (let ((meta-tag-index (string-contains line meta-tag-prefix)))
> +        (when meta-tag-index
> +          (let* ((start (+ meta-tag-index meta-tag-prefix-length))
> +                 (end (string-index line #\" start)))
> +            (set! module-metadata
> +                  (string-split (substring/shared line start end) #\spac=
e))))))
> +    (close-port port)
> +    module-metadata))
> +
> +(define (module-meta-data-scs meta-data)
> +  "Return the source control system specified by a module's meta-data."
> +  (string->symbol (list-ref meta-data 1)))
> +
> +(define (module-meta-data-repo-url meta-data goproxy-url)
> +  "Return the URL where the fetcher which will be used can download the =
source
> +control."
> +  (if (member (module-meta-data-scs meta-data) '(fossil mod))
> +      goproxy-url
> +      (list-ref meta-data 2)))
> +
> +(define (source-uri scs-type scs-repo-url file)
> +  "Generate the `origin' block of a package depending on what type of so=
urce
> +control system is being used."
> +  (case scs-type
> +    ((git)
> +     `(origin
> +        (method git-fetch)
> +        (uri (git-reference
> +              (url ,scs-repo-url)
> +              (commit (string-append "v" version))))
> +        (file-name (git-file-name name version))
> +        (sha256
> +         (base32
> +          ,(guix-hash-url file)))))
> +    ((hg)
> +     `(origin
> +        (method hg-fetch)
> +        (uri (hg-reference
> +              (url ,scs-repo-url)
> +              (changeset ,version)))
> +        (file-name (format #f "~a-~a-checkout" name version))))
> +    ((svn)
> +     `(origin
> +        (method svn-fetch)
> +        (uri (svn-reference
> +              (url ,scs-repo-url)
> +              (revision (string->number version))
> +              (recursive? #f)))
> +        (file-name (format #f "~a-~a-checkout" name version))
> +        (sha256
> +         (base32
> +          ,(guix-hash-url file)))))
> +    (else
> +     (raise-exception (format #f "unsupported scs type: ~a" scs-type)))))
> +
> +(define* (go-module->guix-package module-path #:key (goproxy-url "https:=
//proxy.golang.org"))
> +  (call-with-temporary-output-file
> +   (lambda (temp port)
> +     (let* ((latest-version (fetch-latest-version goproxy-url module-pat=
h))
> +            (go.mod-path (fetch-go.mod goproxy-url module-path latest-ve=
rsion
> +                                       temp))
> +            (dependencies (map car (parse-go.mod temp)))
> +            (guix-name (to-guix-package-name module-path))
> +            (root-module-path (infer-module-root module-path))
> +            ;; VCS type and URL are not included in goproxy information.=
 For
> +            ;; this we need to fetch it from the official module page.
> +            (meta-data (fetch-module-meta-data root-module-path))
> +            (scs-type (module-meta-data-scs meta-data))
> +            (scs-repo-url (module-meta-data-repo-url meta-data goproxy-u=
rl)))
> +       (values
> +        `(package
> +           (name ,guix-name)
> +           ;; Elide the "v" prefix Go uses
> +           (version ,(string-trim latest-version #\v))
> +           (source
> +            ,(source-uri scs-type scs-repo-url temp))
> +           (build-system go-build-system)
> +           ,@(maybe-inputs (map to-guix-package-name dependencies))
> +           ;; TODO(katco): It would be nice to make an effort to fetch t=
his
> +           ;; from known forges, e.g. GitHub
> +           (home-page ,(format #f "https://~a" root-module-path))
> +           (synopsis "A Go package")
> +           (description ,(format #f "~a is a Go package." guix-name))
> +           (license #f))
> +        dependencies)))))
> +
> +(define* (go-module-recursive-import package-name
> +                                     #:key (goproxy-url "https://proxy.g=
olang.org"))
> +  (recursive-import
> +   package-name
> +   #:repo->guix-package (lambda* (name . _)
> +                          (go-module->guix-package
> +                           name
> +                           #:goproxy-url goproxy-url))
> +   #:guix-name to-guix-package-name))
> diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm
> index 0a3863f965..1d2b45d942 100644
> --- a/guix/scripts/import.scm
> +++ b/guix/scripts/import.scm
> @@ -77,7 +77,7 @@ rather than \\n."
>  ;;;
>=20=20
>  (define importers '("gnu" "nix" "pypi" "cpan" "hackage" "stackage" "elpa=
" "gem"
> -                    "cran" "crate" "texlive" "json" "opam"))
> +                    "go" "cran" "crate" "texlive" "json" "opam"))
>=20=20
>  (define (resolve-importer name)
>    (let ((module (resolve-interface
> diff --git a/guix/scripts/import/go.scm b/guix/scripts/import/go.scm
> new file mode 100644
> index 0000000000..fde7555973
> --- /dev/null
> +++ b/guix/scripts/import/go.scm
> @@ -0,0 +1,118 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright =C2=A9 2020 Katherine Cox-Buday <cox.katherine.e@HIDDEN>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify it
> +;;; under the terms of the GNU General Public License as published by
> +;;; the Free Software Foundation; either version 3 of the License, or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public License
> +;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
> +
> +(define-module (guix scripts import go)
> +  #:use-module (guix ui)
> +  #:use-module (guix utils)
> +  #:use-module (guix scripts)
> +  #:use-module (guix import go)
> +  #:use-module (guix scripts import)
> +  #:use-module (srfi srfi-1)
> +  #:use-module (srfi srfi-11)
> +  #:use-module (srfi srfi-37)
> +  #:use-module (ice-9 match)
> +  #:use-module (ice-9 format)
> +  #:export (guix-import-go))
> +
> +
> +;;;
> +;;; Command-line options.
> +;;;
> +
> +(define %default-options
> +  '())
> +
> +(define (show-help)
> +  (display (G_ "Usage: guix import go PACKAGE-PATH
> +Import and convert the Go module for PACKAGE-PATH.\n"))
> +  (display (G_ "
> +  -h, --help             display this help and exit"))
> +  (display (G_ "
> +  -V, --version          display version information and exit"))
> +  (display (G_ "
> +  -r, --recursive        generate package expressions for all Go modules\
> + that are not yet in Guix"))
> +  (display (G_ "
> +  -p, --goproxy=3DGOPROXY  specify which goproxy server to use"))
> +  (newline)
> +  (show-bug-report-information))
> +
> +(define %options
> +  ;; Specification of the command-line options.
> +  (cons* (option '(#\h "help") #f #f
> +                 (lambda args
> +                   (show-help)
> +                   (exit 0)))
> +         (option '(#\V "version") #f #f
> +                 (lambda args
> +                   (show-version-and-exit "guix import go")))
> +         (option '(#\r "recursive") #f #f
> +                 (lambda (opt name arg result)
> +                   (alist-cons 'recursive #t result)))
> +         (option '(#\p "goproxy") #t #f
> +                 (lambda (opt name arg result)
> +                   (alist-cons 'goproxy
> +                               (string->symbol arg)
> +                               (alist-delete 'goproxy result))))
> +         %standard-import-options))
> +
> +
> +;;;
> +;;; Entry point.
> +;;;
> +
> +(define (guix-import-go . args)
> +  (define (parse-options)
> +    ;; Return the alist of option values.
> +    (args-fold* args %options
> +                (lambda (opt name arg result)
> +                  (leave (G_ "~A: unrecognized option~%") name))
> +                (lambda (arg result)
> +                  (alist-cons 'argument arg result))
> +                %default-options))
> +
> +  (let* ((opts (parse-options))
> +         (args (filter-map (match-lambda
> +                             (('argument . value)
> +                              value)
> +                             (_ #f))
> +                           (reverse opts))))
> +    (match args
> +      ((module-name)
> +       (if (assoc-ref opts 'recursive)
> +           (map (match-lambda
> +                  ((and ('package ('name name) . rest) pkg)
> +                   `(define-public ,(string->symbol name)
> +                      ,pkg))
> +                  (_ #f))
> +                (go-module-recursive-import module-name
> +                                            #:goproxy-url
> +                                            (or (assoc-ref opts 'goproxy)
> +                                                "https://proxy.golang.or=
g")))
> +           (let ((sexp (go-module->guix-package module-name
> +                                                #:goproxy-url
> +                                                (or (assoc-ref opts 'gop=
roxy)
> +                                                    "https://proxy.golan=
g.org"))))
> +             (unless sexp
> +               (leave (G_ "failed to download meta-data for module '~a'~=
%")
> +                      module-name))
> +             sexp)))
> +      (()
> +       (leave (G_ "too few arguments~%")))
> +      ((many ...)
> +       (leave (G_ "too many arguments~%"))))))

--=20
Katherine




Information forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.

Message received at 44178 <at> debbugs.gnu.org:


Received: (at 44178) by debbugs.gnu.org; 10 Dec 2020 03:14:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 09 22:14:36 2020
Received: from localhost ([127.0.0.1]:36616 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1knCPb-0002v6-Vy
	for submit <at> debbugs.gnu.org; Wed, 09 Dec 2020 22:14:36 -0500
Received: from smtp2-g21.free.fr ([212.27.42.2]:4883)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dftxbs3e@HIDDEN>) id 1knCPZ-0002uw-Jy
 for 44178 <at> debbugs.gnu.org; Wed, 09 Dec 2020 22:14:34 -0500
Received: from [IPv6:2a01:e0a:2a2:1350:cd10:777c:7b57:3bb6] (unknown
 [IPv6:2a01:e0a:2a2:1350:cd10:777c:7b57:3bb6])
 (Authenticated sender: dftxbs3e)
 by smtp2-g21.free.fr (Postfix) with ESMTPSA id 6FD6520039C
 for <44178 <at> debbugs.gnu.org>; Thu, 10 Dec 2020 04:14:31 +0100 (CET)
Message-ID: <97498b5966a4e1cd64bc85ec30bbd8007df09173.camel@HIDDEN>
Subject: Re:
From: dftxbs3e <dftxbs3e@HIDDEN>
To: 44178 <at> debbugs.gnu.org
Date: Thu, 10 Dec 2020 04:14:31 +0100
In-Reply-To: <bc9fc787f49a9722396ed97554e2a7c634f830a0.camel@HIDDEN>
References: <9395ba7c7499d6c4423982486a0a0fb31cb76e93.camel@HIDDEN>
 <bc9fc787f49a9722396ed97554e2a7c634f830a0.camel@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
User-Agent: Evolution 3.34.2 
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 44178
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

It now fails with:

$ ./pre-inst-env guix import go -r github.com/hashicorp/consul/api
WARNING: (guix import go): `url-fetch' imported from both (guix import
utils) and (guix build download)

Starting download of /tmp/guix-file.i8tqa2
From 
https://proxy.golang.org/github.com/hashicorp/consul/api/@v/v1.8.0.mod.
..
 v1.8.0.mod  424B                     334KiB/s 00:00
[##################] 100.0%
Backtrace:
In ice-9/boot-9.scm:
  1736:10 17 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
          16 (apply-smob/0 #<thunk 7fc5871054a0>)
In ice-9/boot-9.scm:
    718:2 15 (call-with-prompt _ _ #<procedure default-prompt-handle…>)
In ice-9/eval.scm:
    619:8 14 (_ #(#(#<directory (guile-user) 7fc586d40f00>)))
In guix/ui.scm:
  2127:12 13 (run-guix-command _ . _)
In guix/scripts/import.scm:
   120:11 12 (guix-import . _)
In ice-9/eval.scm:
    159:9 11 (_ _)
In guix/import/utils.scm:
   458:31 10 (recursive-import _ #:repo->guix-package _ #:guix-name _
…)
   449:33  9 (lookup-node "github.com/hashicorp/consul/api" #f)
In guix/utils.scm:
    697:8  8 (call-with-temporary-output-file _)
In ice-9/eval.scm:
   293:34  7 (_ #(#(#(#(#<directory (guix import go) 7fc…> …) …) …) …))
    159:9  6 (_ #(#(#(#(#<directory (guix import go) 7fc…> …) …) …) …))
In ice-9/ports.scm:
   445:17  5 (call-with-input-file _ _ #:binary _ #:encoding _ # _)
    470:4  4 (_ _)
In ice-9/eval.scm:
    619:8  3 (_ #(#(#(#<directory (guix import go) 7fc584cbef00>)) …))
    619:8  2 (_ #(#(#<directory (guix import go) 7fc584cbef00> # …) …))
   293:34  1 (_ #(#(#(#(#(#<directory (guix import go…> …) …) …) …) …))
In unknown file:
           0 (list-ref ("replace" "github.com/hashicorp/consul/s…" …)
…)

ERROR: In procedure list-ref:
In procedure list-ref: Argument 2 out of range: 4


It's probably because the go.mod file contains a self-referencing
replace line (seems unsupported by the code):

module github.com/hashicorp/consul/api

go 1.12

replace github.com/hashicorp/consul/sdk => ../sdk

require (
	github.com/hashicorp/consul/sdk v0.7.0
	github.com/hashicorp/go-cleanhttp v0.5.1
	github.com/hashicorp/go-hclog v0.12.0
	github.com/hashicorp/go-rootcerts v1.0.2
	github.com/hashicorp/go-uuid v1.0.1
	github.com/hashicorp/serf v0.9.5
	github.com/mitchellh/mapstructure v1.1.2
	github.com/stretchr/testify v1.4.0
)





Information forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.

Message received at 44178 <at> debbugs.gnu.org:


Received: (at 44178) by debbugs.gnu.org; 10 Dec 2020 02:42:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 09 21:42:19 2020
Received: from localhost ([127.0.0.1]:36609 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1knBuN-0002BM-CH
	for submit <at> debbugs.gnu.org; Wed, 09 Dec 2020 21:42:19 -0500
Received: from smtp2-g21.free.fr ([212.27.42.2]:63520)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dftxbs3e@HIDDEN>) id 1knBuL-0002BD-AM
 for 44178 <at> debbugs.gnu.org; Wed, 09 Dec 2020 21:42:18 -0500
Received: from [IPv6:2a01:e0a:2a2:1350:cd10:777c:7b57:3bb6] (unknown
 [IPv6:2a01:e0a:2a2:1350:cd10:777c:7b57:3bb6])
 (Authenticated sender: dftxbs3e)
 by smtp2-g21.free.fr (Postfix) with ESMTPSA id E352A20039E
 for <44178 <at> debbugs.gnu.org>; Thu, 10 Dec 2020 03:42:14 +0100 (CET)
Message-ID: <bc9fc787f49a9722396ed97554e2a7c634f830a0.camel@HIDDEN>
Subject: Re:
From: dftxbs3e <dftxbs3e@HIDDEN>
To: 44178 <at> debbugs.gnu.org
Date: Thu, 10 Dec 2020 03:42:14 +0100
In-Reply-To: <9395ba7c7499d6c4423982486a0a0fb31cb76e93.camel@HIDDEN>
References: <9395ba7c7499d6c4423982486a0a0fb31cb76e93.camel@HIDDEN>
Content-Type: multipart/mixed; boundary="=-ZH7kF50bShwKrEP89x8F"
User-Agent: Evolution 3.34.2 
MIME-Version: 1.0
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 44178
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)


--=-ZH7kF50bShwKrEP89x8F
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit

On Wed, 2020-12-09 at 15:22 +0100, dftxbs3e wrote:
> Thanks a lot for this!
> 
> I'm getting some error trying to use it (patching on top of
> 8e2aad26ae9b7365db83d4f6c74e9e79c57766a6), maybe that's fixed in your
> local changes?
> 
> $ ./pre-inst-env guix import go -r github.com/syncthing/syncthing
> WARNING: (guix import go): `url-fetch' imported from both (guix
> import
> utils) and (guix build download)
> Backtrace:
> In ice-9/boot-9.scm:
>   1736:10  7 (with-exception-handler _ _ #:unwind? _ # _)
> In unknown file:
>            6 (apply-smob/0 #<thunk 7ff10807d9a0>)
> In ice-9/boot-9.scm:
>     718:2  5 (call-with-prompt _ _ #<procedure default-prompt-
> handle…>)
> In ice-9/eval.scm:
>     619:8  4 (_ #(#(#<directory (guile-user) 7ff107cadf00>)))
> In guix/ui.scm:
>   2127:12  3 (run-guix-command _ . _)
> In guix/scripts/import.scm:
>    120:11  2 (guix-import . _)
> In ice-9/eval.scm:
>     159:9  1 (_ #(#(#(#(#(#(#(#(#(#<directo…>) …) …) …) …) …) …) …)
> …))
> In guix/import/utils.scm:
>     429:0  0 (recursive-import _ #:repo->guix-package _ #:guix-name _
> …)
> 
> guix/import/utils.scm:429:0: In procedure recursive-import:
> Invalid keyword: #f

I could fix it using the attached patch!

However, I noticed it doesnt pin versions in GNU Guix to what they are
in go.mod file, is that expected? It always takes the latest. It might
work but I am thinking it might cause breakage at some point?

Thank you!



--=-ZH7kF50bShwKrEP89x8F
Content-Disposition: attachment;
	filename*0=go-module-importer-fix-guix-8e2aad26ae9b7365db83d4f6c74e9e79c;
	filename*1=57766a6.patch
Content-Type: text/x-patch;
	name*0=go-module-importer-fix-guix-8e2aad26ae9b7365db83d4f6c74e9e79c5776;
	name*1=6a6.patch; charset="UTF-8"
Content-Transfer-Encoding: base64

ZGlmZiAtLWdpdCBhL2d1aXgvaW1wb3J0L2dvLnNjbSBiL2d1aXgvaW1wb3J0L2dvLnNjbQppbmRl
eCA2MTAwOWYzNTY1Li5jN2ExYjFhNWQ0IDEwMDY0NAotLS0gYS9ndWl4L2ltcG9ydC9nby5zY20K
KysrIGIvZ3VpeC9pbXBvcnQvZ28uc2NtCkBAIC0yMyw3ICsyMyw3IEBACiAgICM6dXNlLW1vZHVs
ZSAoaWNlLTkgcmVnZXgpCiAgICM6dXNlLW1vZHVsZSAoc3JmaSBzcmZpLTEpCiAgICM6dXNlLW1v
ZHVsZSAoc3JmaSBzcmZpLTkpCi0gICM6dXNlLW1vZHVsZSAoZ3VpeCBqc29uKQorICAjOnVzZS1t
b2R1bGUgKGpzb24pCiAgICM6dXNlLW1vZHVsZSAoKGd1aXggZG93bmxvYWQpICM6cHJlZml4IGRv
d25sb2FkOikKICAgIzp1c2UtbW9kdWxlIChndWl4IGltcG9ydCB1dGlscykKICAgIzp1c2UtbW9k
dWxlIChndWl4IGltcG9ydCBqc29uKQpAQCAtMjY4LDkgKzI2OCw5IEBAIGNvbnRyb2wgc3lzdGVt
IGlzIGJlaW5nIHVzZWQuIgogCiAoZGVmaW5lKiAoZ28tbW9kdWxlLXJlY3Vyc2l2ZS1pbXBvcnQg
cGFja2FnZS1uYW1lCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIzprZXkg
KGdvcHJveHktdXJsICJodHRwczovL3Byb3h5LmdvbGFuZy5vcmciKSkKLSAgKHJlY3Vyc2l2ZS1p
bXBvcnQgcGFja2FnZS1uYW1lICNmCisgIChyZWN1cnNpdmUtaW1wb3J0IHBhY2thZ2UtbmFtZQog
ICAgICAgICAgICAgICAgICAgICAjOnJlcG8tPmd1aXgtcGFja2FnZQotICAgICAgICAgICAgICAg
ICAgICAobGFtYmRhIChuYW1lIF8pCisgICAgICAgICAgICAgICAgICAgIChsYW1iZGEqIChuYW1l
ICM6a2V5IHJlcG8gdmVyc2lvbikKICAgICAgICAgICAgICAgICAgICAgICAoZ28tbW9kdWxlLT5n
dWl4LXBhY2thZ2UgbmFtZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAjOmdvcHJveHktdXJsIGdvcHJveHktdXJsKSkKICAgICAgICAgICAgICAgICAgICAg
IzpndWl4LW5hbWUgdG8tZ3VpeC1wYWNrYWdlLW5hbWUpKQo=


--=-ZH7kF50bShwKrEP89x8F--





Information forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.

Message received at 44178 <at> debbugs.gnu.org:


Received: (at 44178) by debbugs.gnu.org; 9 Dec 2020 14:23:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 09 09:23:41 2020
Received: from localhost ([127.0.0.1]:33159 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kn0NY-0006G3-WA
	for submit <at> debbugs.gnu.org; Wed, 09 Dec 2020 09:23:41 -0500
Received: from smtp4-g21.free.fr ([212.27.42.4]:60222)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dftxbs3e@HIDDEN>) id 1kn0NU-0006Fn-KU
 for 44178 <at> debbugs.gnu.org; Wed, 09 Dec 2020 09:23:38 -0500
Received: from [192.168.0.27] (unknown [82.64.145.38])
 (Authenticated sender: dftxbs3e)
 by smtp4-g21.free.fr (Postfix) with ESMTPSA id 1025419F5CF
 for <44178 <at> debbugs.gnu.org>; Wed,  9 Dec 2020 15:23:33 +0100 (CET)
Message-ID: <9395ba7c7499d6c4423982486a0a0fb31cb76e93.camel@HIDDEN>
Subject: 
From: dftxbs3e <dftxbs3e@HIDDEN>
To: 44178 <at> debbugs.gnu.org
Date: Wed, 09 Dec 2020 15:22:18 +0100
Content-Type: text/plain; charset="UTF-8"
User-Agent: Evolution 3.34.2 
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 4.9 (++++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: Thanks a lot for this! I'm getting some error trying to use
 it (patching on top of 8e2aad26ae9b7365db83d4f6c74e9e79c57766a6), maybe that's
 fixed in your local changes? $ ./pre-inst-env guix import go -r
 github.com/syncthing/syncthing
 WARNING: (guix import go): `url-fetch' imported from both (guix import utils)
 and (guix build download) Backtrace: In ice-9/boot-9.scm [...] 
 Content analysis details:   (4.9 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.3 HK_RANDOM_FROM         From username looks random
 0.6 HK_RANDOM_ENVFROM      Envelope sender username looks random
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [212.27.42.4 listed in list.dnswl.org]
 0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
 [212.27.42.4 listed in wl.mailspike.net]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.0 SPF_NONE               SPF: sender does not publish an SPF Record
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (dftxbs3e[at]free.fr)
 0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders
 2.0 BLANK_SUBJECT          Subject is present but empty
 2.0 SPOOFED_FREEMAIL       No description available.
X-Debbugs-Envelope-To: 44178
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Thanks a lot for this! I'm getting some error trying to use
    it (patching on top of 8e2aad26ae9b7365db83d4f6c74e9e79c57766a6), maybe that's
    fixed in your local changes? $ ./pre-inst-env guix import go -r github.com/syncthing/syncthing
    WARNING: (guix import go): `url-fetch' imported from both (guix import utils)
    and (guix build download) Backtrace: In ice-9/boot-9.scm [...] 
 
 Content analysis details:   (2.0 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [212.27.42.4 listed in list.dnswl.org]
  0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
                             [212.27.42.4 listed in wl.mailspike.net]
  0.3 HK_RANDOM_FROM         From username looks random
  0.6 HK_RANDOM_ENVFROM      Envelope sender username looks random
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
  0.0 SPF_NONE               SPF: sender does not publish an SPF Record
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (dftxbs3e[at]free.fr)
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager
  0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders
  2.0 BLANK_SUBJECT          Subject is present but empty

Thanks a lot for this!

I'm getting some error trying to use it (patching on top of
8e2aad26ae9b7365db83d4f6c74e9e79c57766a6), maybe that's fixed in your
local changes?

$ ./pre-inst-env guix import go -r github.com/syncthing/syncthing
WARNING: (guix import go): `url-fetch' imported from both (guix import
utils) and (guix build download)
Backtrace:
In ice-9/boot-9.scm:
  1736:10  7 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
           6 (apply-smob/0 #<thunk 7ff10807d9a0>)
In ice-9/boot-9.scm:
    718:2  5 (call-with-prompt _ _ #<procedure default-prompt-handle…>)
In ice-9/eval.scm:
    619:8  4 (_ #(#(#<directory (guile-user) 7ff107cadf00>)))
In guix/ui.scm:
  2127:12  3 (run-guix-command _ . _)
In guix/scripts/import.scm:
   120:11  2 (guix-import . _)
In ice-9/eval.scm:
    159:9  1 (_ #(#(#(#(#(#(#(#(#(#<directo…>) …) …) …) …) …) …) …) …))
In guix/import/utils.scm:
    429:0  0 (recursive-import _ #:repo->guix-package _ #:guix-name _
…)

guix/import/utils.scm:429:0: In procedure recursive-import:
Invalid keyword: #f





Information forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.

Message received at 44178 <at> debbugs.gnu.org:


Received: (at 44178) by debbugs.gnu.org; 11 Nov 2020 20:48:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 11 15:48:26 2020
Received: from localhost ([127.0.0.1]:42958 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kcx2U-0000WW-UY
	for submit <at> debbugs.gnu.org; Wed, 11 Nov 2020 15:48:26 -0500
Received: from mail-il1-f169.google.com ([209.85.166.169]:46754)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <cox.katherine.e@HIDDEN>) id 1kcx2Q-0000WF-Jt
 for 44178 <at> debbugs.gnu.org; Wed, 11 Nov 2020 15:48:22 -0500
Received: by mail-il1-f169.google.com with SMTP id a20so3188783ilk.13
 for <44178 <at> debbugs.gnu.org>; Wed, 11 Nov 2020 12:48:18 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=+MxwqtKzYmC/HnM93tPv6rhG6PUxVf3KaxMdg82XBAs=;
 b=E8rJmYziBt3hK9T5sxcVwxIXXAmud5yEi55UKBlVCeuXKsFbMBiJTm7DmVNnqsgSbl
 roGAMAG9E/S7HucJBiAsmNYQzHmf3a2R+K42TzVIJ3fu4pQEUj1UHRiiJZnxDHjruKY4
 sb0AYpMIOQzEobPOa97y7HyYVFI5gAVPLW0PmULJbGpldWsojxfC/xGgTalFt6B73Pzi
 Fysex3xkxTgoTsPJHXSct6XIrLFAzF09HcsIfxXJSZRE665KKXEzIk2fzkWePd+jrpdk
 Fq2fvFnz4fuOYnL8fo+96px7u6CWJbJEIQEWLGbNfnbqQ5qZVZ0/8O0k2si0bjmbUkjJ
 7vng==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=+MxwqtKzYmC/HnM93tPv6rhG6PUxVf3KaxMdg82XBAs=;
 b=oDRZU7WBOhAzLxCyX1aojUZXRiIQByTiK80WDKWiGEn9xD6kinfKe4AkHA3GKidEhd
 iUJhrYTqKiFiqr+GFjbONmsL20IDlxJk6Urp73xp9l5ldaiBsVPvxfRyOvbQx/wxvgLX
 FjGouNAsLdjD2CamRRU7f6qpHLkT03sImn75NvOcezzK8LK7i9qrUXZcgCZCadrTFGMG
 Vlmaxv8ggZIVnEzK7YNqljqTFPKLZtl3u9LHTKl4dt4A3B3tj7bDLLfyc7Uxtl94+sum
 PIQgL4yyKkVN5Do2fiIC6/f/QTmIQLJxFcdY+mvtUdnvIGXNe1uUFWrQ5dcwBQiMlAdX
 y5uw==
X-Gm-Message-State: AOAM5311aVPKRRsVZsTZQuoNiq5/cUgIK8EN5eTr6gHlR2hPjDKCSgeg
 OQTAGt+/9PC0e2MiW8k3XbY=
X-Google-Smtp-Source: ABdhPJyo+zFYmTwxwTzKFvclNSiDlotuDzDWuJIE8LKe6EAxRMvyLmdEw7HRQGDThy6FwYLG9/fZwg==
X-Received: by 2002:a05:6e02:2cc:: with SMTP id
 v12mr20786794ilr.115.1605127692911; 
 Wed, 11 Nov 2020 12:48:12 -0800 (PST)
Received: from washu-v4 (172-221-246-205.res.spectrum.com. [172.221.246.205])
 by smtp.gmail.com with ESMTPSA id
 y9sm1725065ily.85.2020.11.11.12.48.11
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 11 Nov 2020 12:48:11 -0800 (PST)
From: Katherine Cox-Buday <cox.katherine.e@HIDDEN>
To: Marius Bakke <marius@HIDDEN>
Subject: Re: [bug#44178] Add a Go Module Importer
References: <87sga5kpdp.fsf@HIDDEN> <87blg5dkla.fsf@HIDDEN>
Date: Wed, 11 Nov 2020 14:48:10 -0600
In-Reply-To: <87blg5dkla.fsf@HIDDEN> (Marius Bakke's message of "Tue, 10 Nov
 2020 21:26:41 +0100")
Message-ID: <87v9ebpqlx.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 44178
Cc: 44178 <at> debbugs.gnu.org, Helio Machado <0x2b3bfa0@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Marius Bakke <marius@HIDDEN> writes:

> I just want to say thanks a lot for this!  I tested it, and it pretty
> much works as advertised.

You're very welcome!

I have more changes locally which fix some edge-cases. I'm using
`go-ethereum` as my test case since someone mentioned that. Plus I need
to make some of the changes Ludovic pointed out. Still, we're underway!

-- 
Katherine




Information forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.

Message received at 44178 <at> debbugs.gnu.org:


Received: (at 44178) by debbugs.gnu.org; 11 Nov 2020 01:23:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 10 20:23:44 2020
Received: from localhost ([127.0.0.1]:39569 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kcerQ-0006Dc-DP
	for submit <at> debbugs.gnu.org; Tue, 10 Nov 2020 20:23:44 -0500
Received: from mail-qt1-f173.google.com ([209.85.160.173]:33788)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <0x2b3bfa0@HIDDEN>) id 1kcerO-0006DP-1T
 for 44178 <at> debbugs.gnu.org; Tue, 10 Nov 2020 20:23:42 -0500
Received: by mail-qt1-f173.google.com with SMTP id i12so300949qtj.0
 for <44178 <at> debbugs.gnu.org>; Tue, 10 Nov 2020 17:23:42 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
 bh=y8nrYLjKxck1A5J3/CkEvWoKDcNwo+P2S2p8LTJikj0=;
 b=pJ92/7zMYpww19dNeo18coiYTUrcwoiwRN4F/lnifFVRL+J08XedjNKy3rV3ekS6GQ
 IHKZlZY6l4GgB0TwHVVwee72JboJTmiZRhs3Hdygr0gFPKPNa34VwLurJuUO7IRrUmcy
 LCLtsDAZqdCR8Oy7BBK4Up3ryYfE24oMsbhLELMtp5ZI7YMvwLqVlcAM1B+f/B1/L2ow
 qoidMmUzhBbCkTK6zkXRNUnTWK6cmXuX5pScDHffRzisu+C6eMVNzeJNV6Z8uOK1T1LA
 j0xBNhBSW1dbqu3S4lynuci1PhyPu28WyRMNcUySVMfovd5FIHAoy3iinzAdYJqQnfZS
 cshg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to;
 bh=y8nrYLjKxck1A5J3/CkEvWoKDcNwo+P2S2p8LTJikj0=;
 b=meFK0MF+eoC+DOnwoZ5xrQxpV1c6HTzZF44zpNduMk36PQAuiMvr6zM0ezVutEL4nT
 lVneCVs+j4OyVSHa4rSrpcnq6XPOhoaQlHdpG4KUikaZOP03H7gGaJ2cW/TM7pL8zrup
 2KxJe0SbDSP0Zq+7lvIZmJw2BmLoVA+TukxJhHAJYK6vcWk6nLGFozIGXaL3q/eoTGbx
 wzQym2Cj4/g1KL/R3angSoPbspUGseOqC8DYRh8eKKlephLjnTcY+LmL/viK8pUEZkvh
 gW0CPD+kOvFsSpQgi+tsUnyAOTiFoOW0yzZ0b6yWJpNXtlLDY6Rsrc1fqhYKR9X2mKOs
 jCgQ==
X-Gm-Message-State: AOAM532NlKbhFlzPtE8JKDAgLr3fcZZaSkvd3IRLog8dASOnBgXg6Un0
 QHUBHFZeHybsj2AhkWsATIM9TrUFSB6tUwF2LKy5urTWU2m0Fg==
X-Google-Smtp-Source: ABdhPJwUFF5LFW9/3Jc0IaAkwlIhgRoO1lw96fGyv9DWUA2xlV8DdmcubDXszWCkJL6MTmRRSQeku3gX/3yRG9v2OiI=
X-Received: by 2002:aed:38ca:: with SMTP id k68mr9742206qte.28.1605057816323; 
 Tue, 10 Nov 2020 17:23:36 -0800 (PST)
MIME-Version: 1.0
References: <87sga5kpdp.fsf@HIDDEN> <87blg5dkla.fsf@HIDDEN>
 <CANe01w55ZO=_9v0HcDv248UsoLUXb_9WVAgM4LqiZ4E-r1XgXg@HIDDEN>
In-Reply-To: <CANe01w55ZO=_9v0HcDv248UsoLUXb_9WVAgM4LqiZ4E-r1XgXg@HIDDEN>
From: Helio Machado <0x2b3bfa0@HIDDEN>
Date: Wed, 11 Nov 2020 02:23:00 +0100
Message-ID: <CANe01w5DxwrF+APLbcNMaUhs4h05EXC1HdRJ_YT8CRy6ULxUYw@HIDDEN>
Subject: Re: [bug#44178] Add a Go Module Importer
To: 44178 <at> debbugs.gnu.org
Content-Type: multipart/alternative; boundary="000000000000fc6c5a05b3caa49f"
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 44178
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

--000000000000fc6c5a05b3caa49f
Content-Type: text/plain; charset="UTF-8"

Thanks for the ping, Marius! I've been quite busy with some yak shaving
tasks, but my importer is already working and has some interesting
improvements, like elegant module fetching from the official module proxy,
license extraction and recursive import support.

I need to fix an esoteric bug that trips the kernel's out-of-memory killer
when building a derivation with dependencies, but the importer part works
pretty well.

You can take a look to [my changes][1] for some readily backportable ideas,
like [the compact algorithm for uppercase path escaping][2].

Please forgive the code quality and the possible backwards-compatibility
mistakes; this is an unfinished proof of concept.

$ guix import go-modules -r github.com/FiloSottile/age # Please refer to
the issue 43872 for more information about the resting environment

[1]:
https://github.com/0x2b3bfa0/guix-go-modules/commit/5defe897065c5d3e63740932b360474132c77877
[2]:
https://github.com/0x2b3bfa0/guix-go-modules/blob/main/guix/build-system/go.scm#L65-L71

On Wed, 11 Nov 2020 at 02:19, Helio Machado <0x2b3bfa0@HIDDEN> wrote:

> Thanks for the ping, Marius! I've been quite busy with some yak shaving
> tasks, but my importer is already working and has some interesting
> improvements, like elegant module fetching from the official module proxy,
> license extraction and recursive import support.
>
> I need to fix an esoteric bug that trips the kernel's out-of-memory killer
> when building a derivation with dependencies, but the importer part works
> pretty well.
>
> You can take a look to [my changes][1] for some readily backportable
> ideas, like [the compact algorithm for uppercase path escaping][2].
>
> Please forgive the code quality and the possible backwards-compatibility
> mistakes; this is an unfinished proof of concept.
>
> [1]:
> https://github.com/0x2b3bfa0/guix-go-modules/commit/5defe897065c5d3e63740932b360474132c77877
> [2]:
> https://github.com/0x2b3bfa0/guix-go-modules/blob/main/guix/build-system/go.scm#L65-L71
>
> On Tue, 10 Nov 2020 at 21:26, Marius Bakke <marius@HIDDEN> wrote:
>
>> Katherine Cox-Buday <cox.katherine.e@HIDDEN> writes:
>>
>> >>From cc92cbcf5ae89891f478f319e955419800bdfcf9 Mon Sep 17 00:00:00 2001
>> > From: Katherine Cox-Buday <cox.katherine.e@HIDDEN>
>> > Date: Thu, 22 Oct 2020 19:40:17 -0500
>> > Subject: [PATCH] * guix/import/go.scm: Created Go Importer *
>> >  guix/scripts/import.scm: Created Go Importer Subcommand *
>> guix/import/go.scm
>> >  (importers): Added Go Importer Subcommand
>>
>> I just want to say thanks a lot for this!  I tested it, and it pretty
>> much works as advertised.
>>
>> Cc'ing Helio who was working on a Go importer as well recently.
>>
>

--000000000000fc6c5a05b3caa49f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div di=
r=3D"ltr"><div dir=3D"ltr">Thanks for the ping, Marius! I&#39;ve been quite=
 busy with some yak shaving tasks, but my importer is already working and h=
as some interesting improvements, like elegant module fetching from the off=
icial module proxy, license extraction and recursive=C2=A0import support.</=
div><div dir=3D"ltr"><br><div>I need to fix an esoteric bug that trips the =
kernel&#39;s out-of-memory killer when building a derivation with dependenc=
ies, but the importer part works pretty well.</div><div><br></div><div>You =
can take a look to [my changes][1] for some readily backportable ideas, lik=
e [the compact algorithm for uppercase path escaping][2].</div><div><br></d=
iv><div>Please forgive the code quality and the possible backwards-compatib=
ility mistakes; this is an unfinished proof of concept.</div><div><br></div=
><div>$ guix import go-modules -r <a href=3D"http://github.com/FiloSottile/=
age" target=3D"_blank">github.com/FiloSottile/age</a> # Please refer to the=
 issue 43872 for more information about the resting environment</div><div><=
br></div><div>[1]:=C2=A0<a href=3D"https://github.com/0x2b3bfa0/guix-go-mod=
ules/commit/5defe897065c5d3e63740932b360474132c77877" target=3D"_blank">htt=
ps://github.com/0x2b3bfa0/guix-go-modules/commit/5defe897065c5d3e63740932b3=
60474132c77877</a></div><div>[2]:=C2=A0<a href=3D"https://github.com/0x2b3b=
fa0/guix-go-modules/blob/main/guix/build-system/go.scm#L65-L71" target=3D"_=
blank">https://github.com/0x2b3bfa0/guix-go-modules/blob/main/guix/build-sy=
stem/go.scm#L65-L71</a></div></div></div></div></div></div></div><br><div c=
lass=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, 11 Nov 2=
020 at 02:19, Helio Machado &lt;<a href=3D"mailto:0x2b3bfa0@HIDDEN" targ=
et=3D"_blank">0x2b3bfa0@HIDDEN</a>&gt; wrote:<br></div><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;bo=
rder-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">=
<div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr">Thanks =
for the ping, Marius! I&#39;ve been quite busy with some yak shaving tasks,=
 but my importer is already working and has some interesting improvements, =
like elegant module fetching from the official module proxy, license extrac=
tion and recursive=C2=A0import support.</div><div dir=3D"ltr"><br><div>I ne=
ed to fix an esoteric bug that trips the kernel&#39;s out-of-memory killer =
when building a derivation with dependencies, but the importer part works p=
retty well.</div><div><br></div><div>You can take a look to [my changes][1]=
 for some readily backportable ideas, like [the compact algorithm for upper=
case path escaping][2].</div><div><br></div><div>Please forgive the code qu=
ality and the possible backwards-compatibility mistakes; this is an unfinis=
hed proof of concept.</div><div><br></div><div>[1]: <a href=3D"https://gith=
ub.com/0x2b3bfa0/guix-go-modules/commit/5defe897065c5d3e63740932b360474132c=
77877" target=3D"_blank">https://github.com/0x2b3bfa0/guix-go-modules/commi=
t/5defe897065c5d3e63740932b360474132c77877</a></div><div>[2]:=C2=A0<a href=
=3D"https://github.com/0x2b3bfa0/guix-go-modules/blob/main/guix/build-syste=
m/go.scm#L65-L71" target=3D"_blank">https://github.com/0x2b3bfa0/guix-go-mo=
dules/blob/main/guix/build-system/go.scm#L65-L71</a></div></div></div></div=
></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr"=
>On Tue, 10 Nov 2020 at 21:26, Marius Bakke &lt;<a href=3D"mailto:marius@gn=
u.org" target=3D"_blank">marius@HIDDEN</a>&gt; wrote:<br></div><blockquote=
 class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:=
1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left=
:1ex">Katherine Cox-Buday &lt;<a href=3D"mailto:cox.katherine.e@HIDDEN" =
target=3D"_blank">cox.katherine.e@HIDDEN</a>&gt; writes:<br>
<br>
&gt;&gt;From cc92cbcf5ae89891f478f319e955419800bdfcf9 Mon Sep 17 00:00:00 2=
001<br>
&gt; From: Katherine Cox-Buday &lt;<a href=3D"mailto:cox.katherine.e@gmail.=
com" target=3D"_blank">cox.katherine.e@HIDDEN</a>&gt;<br>
&gt; Date: Thu, 22 Oct 2020 19:40:17 -0500<br>
&gt; Subject: [PATCH] * guix/import/go.scm: Created Go Importer *<br>
&gt;=C2=A0 guix/scripts/import.scm: Created Go Importer Subcommand * guix/i=
mport/go.scm<br>
&gt;=C2=A0 (importers): Added Go Importer Subcommand<br>
<br>
I just want to say thanks a lot for this!=C2=A0 I tested it, and it pretty<=
br>
much works as advertised.<br>
<br>
Cc&#39;ing Helio who was working on a Go importer as well recently.<br>
</blockquote></div>
</blockquote></div>

--000000000000fc6c5a05b3caa49f--




Information forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.

Message received at 44178 <at> debbugs.gnu.org:


Received: (at 44178) by debbugs.gnu.org; 10 Nov 2020 20:26:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 10 15:26:52 2020
Received: from localhost ([127.0.0.1]:39035 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kcaE8-0002wy-1i
	for submit <at> debbugs.gnu.org; Tue, 10 Nov 2020 15:26:52 -0500
Received: from eggs.gnu.org ([209.51.188.92]:37276)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <marius@HIDDEN>) id 1kcaE6-0002wZ-Gi
 for 44178 <at> debbugs.gnu.org; Tue, 10 Nov 2020 15:26:50 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:40212)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <marius@HIDDEN>)
 id 1kcaE1-0007XA-7Q; Tue, 10 Nov 2020 15:26:45 -0500
Received: from host-37-191-236-253.lynet.no ([37.191.236.253]:51050
 helo=localhost)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <marius@HIDDEN>)
 id 1kcaE0-0004zO-02; Tue, 10 Nov 2020 15:26:44 -0500
From: Marius Bakke <marius@HIDDEN>
To: Katherine Cox-Buday <cox.katherine.e@HIDDEN>, 44178 <at> debbugs.gnu.org
Subject: Re: [bug#44178] Add a Go Module Importer
In-Reply-To: <87sga5kpdp.fsf@HIDDEN>
References: <87sga5kpdp.fsf@HIDDEN>
Date: Tue, 10 Nov 2020 21:26:41 +0100
Message-ID: <87blg5dkla.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 44178
Cc: Helio Machado <0x2b3bfa0@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain

Katherine Cox-Buday <cox.katherine.e@HIDDEN> writes:

>>From cc92cbcf5ae89891f478f319e955419800bdfcf9 Mon Sep 17 00:00:00 2001
> From: Katherine Cox-Buday <cox.katherine.e@HIDDEN>
> Date: Thu, 22 Oct 2020 19:40:17 -0500
> Subject: [PATCH] * guix/import/go.scm: Created Go Importer *
>  guix/scripts/import.scm: Created Go Importer Subcommand * guix/import/go.scm
>  (importers): Added Go Importer Subcommand

I just want to say thanks a lot for this!  I tested it, and it pretty
much works as advertised.

Cc'ing Helio who was working on a Go importer as well recently.

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQFDBAEBCgAtFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl+q94EPHG1hcml1c0Bn
bnUub3JnAAoJEKKgbfKjOlT6smgH/ibghemWudkskluP5si3VgUb9JO49uiUgDv3
CaKbs/SOvySUPFgl+8ceLWKgLTQeNVGBgcRBA+aiL0hgAYw/JTBndMHEJ1aZMevw
WUDhIMojlbtfw8wBJuVROjPKcXZW5WXZIKQ1GyqpQ/AP72uZcgI7xB0Qbh0ztQq4
uhZcEiDvgCGfsFWOphpuqxoB2rUpEruLaUj4kkEhccArt79WbgVLF3lTijM1Fhff
Mk3r+4MCdmCL3pZsnDcoY/qNl4jGxqP2mj+rszQFqR6da8gIEhkM52NI3U9VoWLp
gaLq4y4jQp4cdMPY4r2WE5jm7KryGcP/4KHFmf4g/8cvD0Lj5dk=
=hW6A
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.

Message received at 44178 <at> debbugs.gnu.org:


Received: (at 44178) by debbugs.gnu.org; 28 Oct 2020 10:42:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 28 06:42:34 2020
Received: from localhost ([127.0.0.1]:47341 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kXiuX-0003Fs-Ri
	for submit <at> debbugs.gnu.org; Wed, 28 Oct 2020 06:42:34 -0400
Received: from eggs.gnu.org ([209.51.188.92]:38704)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1kXiuV-0003Fg-TU
 for 44178 <at> debbugs.gnu.org; Wed, 28 Oct 2020 06:42:32 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:41114)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1kXiuQ-00040m-Kw; Wed, 28 Oct 2020 06:42:26 -0400
Received: from vpn-0-27.aquilenet.fr ([2a0c:e300:4:27::]:38492 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1kXiuQ-00054k-3K; Wed, 28 Oct 2020 06:42:26 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Katherine Cox-Buday <cox.katherine.e@HIDDEN>
Subject: Re: [bug#44178] Add a Go Module Importer
In-Reply-To: <87sga5kpdp.fsf@HIDDEN> (Katherine Cox-Buday's message of
 "Fri, 23 Oct 2020 09:06:58 -0500")
References: <87sga5kpdp.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Date: Wed, 28 Oct 2020 11:42:24 +0100
Message-ID: <878sbq4oof.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 44178
Cc: 44178 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi Katherine,

Katherine Cox-Buday <cox.katherine.e@HIDDEN> skribis:

>>From cc92cbcf5ae89891f478f319e955419800bdfcf9 Mon Sep 17 00:00:00 2001
> From: Katherine Cox-Buday <cox.katherine.e@HIDDEN>
> Date: Thu, 22 Oct 2020 19:40:17 -0500
> Subject: [PATCH] * guix/import/go.scm: Created Go Importer *
>  guix/scripts/import.scm: Created Go Importer Subcommand * guix/import/go=
.scm
>  (importers): Added Go Importer Subcommand

Nice!  I think that can make a lot of people happy.  :-)

Here=E2=80=99s a quick review.  I won=E2=80=99t promise I can reply to foll=
owups in the
coming days because with the release preparation going on, I=E2=80=99d rath=
er
focus on that.  So perhaps this patch will have to wait until after this
release, but certainly before the next one!

> +(define (escape-capital-letters s)
> +  "To avoid ambiguity when serving from case-insensitive file systems, t=
he
> +$module and $version elements are case-encoded by replacing every upperc=
ase
> +letter with an exclamation mark followed by the corresponding lower-case
> +letter."
> +  (let ((escaped-string (string)))
> +    (string-for-each-index
> +     (lambda (i)
> +       (let ((c (string-ref s i)))
> +         (set! escaped-string
> +           (string-concatenate
> +            (list escaped-string
> +                  (if (char-upper-case? c) "!" "")
> +                  (string (char-downcase c)))))))
> +     s)
> +    escaped-string))

As a general comment, the coding style in Guix is functional =E2=80=9Cby
default=E2=80=9D (info "(guix) Coding Style").  That means we almost never =
use
=E2=80=98set!=E2=80=99 and procedures that modify their arguments.

We also avoid idioms like car/cdr and =E2=80=98do=E2=80=99, which are more =
commonly used
in other Lisps, as you know very well.  ;-)

In the case above, I=E2=80=99d probably use =E2=80=98string-fold=E2=80=99. =
 The resulting code
should be easier to reason about and likely more efficient.

> +(define (fetch-latest-version goproxy-url module-path)
> +  "Fetches the version number of the latest version for MODULE-PATH from=
 the
> +given GOPROXY-URL server."
> +  (assoc-ref
> +   (json-fetch (format #f "~a/~a/@latest" goproxy-url
> +                       (escape-capital-letters module-path)))
> +   "Version"))

I=E2=80=99d suggest using =E2=80=98define-json-mapping=E2=80=99 from (json)=
 like in the other
importers.

> +(define (infer-module-root module-path)
> +  "Go modules can be defined at any level of a repository's tree, but qu=
erying
> +for the meta tag usually can only be done at the webpage at the root of =
the
> +repository. Therefore, it is sometimes necessary to try and derive a mod=
ule's
> +root path from its path. For a set of well-known forges, the pattern of =
what
> +consists of a module's root page is known before hand."
> +  ;; See the following URL for the official Go equivalent:
> +  ;; https://github.com/golang/go/blob/846dce9d05f19a1f53465e62a304dea21=
b99f910/src/cmd/go/internal/vcs/vcs.go#L1026-L1087
> +  (define-record-type <scs>
> +    (make-scs url-prefix root-regex type)
> +    scs?
> +    (url-prefix	scs-url-prefix)
> +    (root-regex scs-root-regex)
> +    (type	scs-type))

Maybe VCS as =E2=80=9Cversion control system=E2=80=9D?  (It took me a while=
 to guess
what =E2=80=9CSCS=E2=80=9D meant.)

> +(define (fetch-module-meta-data module-path)
> +  "Fetches module meta-data from a module's landing page. This is necess=
ary
> +because goproxy servers don't currently provide all the information need=
ed to
> +build a package."
> +  (let* ((port (http-fetch (string->uri (format #f "https://~a?go-get=3D=
1" module-path))))
> +         (module-metadata #f)
> +         (meta-tag-prefix "<meta name=3D\"go-import\" content=3D\"")
> +         (meta-tag-prefix-length (string-length meta-tag-prefix)))
> +    (do ((line (read-line port) (read-line port)))
> +        ((or (eof-object? line)
> +             module-metadata))
> +      (let ((meta-tag-index (string-contains line meta-tag-prefix)))
> +        (when meta-tag-index
> +          (let* ((start (+ meta-tag-index meta-tag-prefix-length))
> +                 (end (string-index line #\" start)))
> +            (set! module-metadata
> +              (string-split (substring/shared line start end) #\space)))=
)))

I=E2=80=99d suggest a named =E2=80=98let=E2=80=99 or =E2=80=98fold=E2=80=99=
 here.

Likewise, instead of concatenating XML strings (which could lead to
malformed XML), I recommend using SXML: you would create an sexp like

  (meta (@ (name "go-import") (content =E2=80=A6)))

and at the end pass it to =E2=80=98sxml->sxml=E2=80=99 (info "(guile) Readi=
ng and
Writing XML").

> +    (else
> +     (raise-exception (format #f "unsupported scs type: ~a" scs-type)))))

=E2=80=98raise-exception=E2=80=99 takes an error condition.  In this case, =
we should use
(srfi srfi-34) for =E2=80=98raise=E2=80=99 write something like:

  (raise (condition (formatted-message (G_ "=E2=80=A6" =E2=80=A6))))

> +(define* (go-module->guix-package module-path #:key (goproxy-url "https:=
//proxy.golang.org"))
> +  (call-with-temporary-output-file
> +   (lambda (temp port)
> +     (let* ((latest-version (fetch-latest-version goproxy-url module-pat=
h))
> +            (go.mod-path (fetch-go.mod goproxy-url module-path latest-ve=
rsion
> +                                       temp))

It seems that =E2=80=98go.mod-path=E2=80=99 isn=E2=80=99t used, and thus =
=E2=80=98fetch-go.mod=E2=80=99 &
co. aren=E2=80=99t used either, or am I overlooking something?

> +            (dependencies (map car (parse-go.mod temp)))

Please use =E2=80=98match=E2=80=99 instead, or perhaps define a record type=
 for the
abstraction at hand.

> +            (guix-name (to-guix-package-name module-path))
> +            (root-module-path (infer-module-root module-path))
> +            ;; SCS type and URL are not included in goproxy information.=
 For
> +            ;; this we need to fetch it from the official module page.
> +            (meta-data (fetch-module-meta-data root-module-path))
> +            (scs-type (module-meta-data-scs meta-data))
> +            (scs-repo-url (module-meta-data-repo-url meta-data goproxy-u=
rl)))
> +       (values
> +        `(package
> +           (name ,guix-name)
> +           ;; Elide the "v" prefix Go uses
> +           (version ,(string-trim latest-version #\v))
> +           (source
> +            ,(source-uri scs-type scs-repo-url temp))
> +           (build-system go-build-system)
> +           ,@(maybe-inputs (map to-guix-package-name dependencies))
> +           ;; TODO(katco): It would be nice to make an effort to fetch t=
his
> +           ;; from known forges, e.g. GitHub
> +           (home-page ,(format #f "https://~a" root-module-path))
> +           (synopsis "A Go package")
> +           (description ,(format #f "~a is a Go package." guix-name))

Maybe something like =E2=80=9Cfill it out!=E2=80=9D so we don=E2=80=99t get=
 patch submissions
with the default synopsis/description.  :-)

> +           (license #f))

Likewise.

Two more things: could you (1) and an entry under =E2=80=9CInvoking guix im=
port=E2=80=9D
in doc/guix.texi, and (2) add tests, taking inspiration from the
existing importer tests?

Thank you!

Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.

Message received at 44178 <at> debbugs.gnu.org:


Received: (at 44178) by debbugs.gnu.org; 28 Oct 2020 10:41:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 28 06:41:55 2020
Received: from localhost ([127.0.0.1]:47330 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kXitv-0003EJ-6V
	for submit <at> debbugs.gnu.org; Wed, 28 Oct 2020 06:41:55 -0400
Received: from eggs.gnu.org ([209.51.188.92]:38518)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1kXitt-0003E8-PQ
 for 44178 <at> debbugs.gnu.org; Wed, 28 Oct 2020 06:41:54 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:41106)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1kXito-0003nQ-FO; Wed, 28 Oct 2020 06:41:48 -0400
Received: from vpn-0-27.aquilenet.fr ([2a0c:e300:4:27::]:38490 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1kXitn-000517-RP; Wed, 28 Oct 2020 06:41:48 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Katherine Cox-Buday <cox.katherine.e@HIDDEN>
Subject: Re: [bug#44178] Add a Go Module Importer
References: <87sga5kpdp.fsf@HIDDEN>
Date: Wed, 28 Oct 2020 11:41:45 +0100
In-Reply-To: <87sga5kpdp.fsf@HIDDEN> (Katherine Cox-Buday's message of
 "Fri, 23 Oct 2020 09:06:58 -0500")
Message-ID: <87a6w64opi.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 44178
Cc: 44178 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi Katherine,

Katherine Cox-Buday <cox.katherine.e@HIDDEN> skribis:

>>From cc92cbcf5ae89891f478f319e955419800bdfcf9 Mon Sep 17 00:00:00 2001
> From: Katherine Cox-Buday <cox.katherine.e@HIDDEN>
> Date: Thu, 22 Oct 2020 19:40:17 -0500
> Subject: [PATCH] * guix/import/go.scm: Created Go Importer *
>  guix/scripts/import.scm: Created Go Importer Subcommand * guix/import/go=
.scm
>  (importers): Added Go Importer Subcommand

Nice!  I think that can make a lot of people happy.  :-)

Here=E2=80=99s a quick review.  I won=E2=80=99t promise I can reply to foll=
owups in the
coming days because with the release preparation going on, I=E2=80=99d rath=
er
focus on that.  So perhaps this patch will have to wait until after this
release, but certainly before the next one!

> +(define (escape-capital-letters s)
> +  "To avoid ambiguity when serving from case-insensitive file systems, t=
he
> +$module and $version elements are case-encoded by replacing every upperc=
ase
> +letter with an exclamation mark followed by the corresponding lower-case
> +letter."
> +  (let ((escaped-string (string)))
> +    (string-for-each-index
> +     (lambda (i)
> +       (let ((c (string-ref s i)))
> +         (set! escaped-string
> +           (string-concatenate
> +            (list escaped-string
> +                  (if (char-upper-case? c) "!" "")
> +                  (string (char-downcase c)))))))
> +     s)
> +    escaped-string))

As a general comment, the coding style in Guix is functional =E2=80=9Cby
default=E2=80=9D (info "(guix) Coding Style").  That means we almost never =
use
=E2=80=98set!=E2=80=99 and procedures that modify their arguments.

We also avoid idioms like car/cdr and =E2=80=98do=E2=80=99, which are more =
commonly used
in other Lisps, as you know very well.  ;-)

In the case above, I=E2=80=99d probably use =E2=80=98string-fold=E2=80=99. =
 The resulting code
should be easier to reason about and likely more efficient.

> +(define (fetch-latest-version goproxy-url module-path)
> +  "Fetches the version number of the latest version for MODULE-PATH from=
 the
> +given GOPROXY-URL server."
> +  (assoc-ref
> +   (json-fetch (format #f "~a/~a/@latest" goproxy-url
> +                       (escape-capital-letters module-path)))
> +   "Version"))

I=E2=80=99d suggest using =E2=80=98define-json-mapping=E2=80=99 from (json)=
 like in the other
importers.

> +(define (infer-module-root module-path)
> +  "Go modules can be defined at any level of a repository's tree, but qu=
erying
> +for the meta tag usually can only be done at the webpage at the root of =
the
> +repository. Therefore, it is sometimes necessary to try and derive a mod=
ule's
> +root path from its path. For a set of well-known forges, the pattern of =
what
> +consists of a module's root page is known before hand."
> +  ;; See the following URL for the official Go equivalent:
> +  ;; https://github.com/golang/go/blob/846dce9d05f19a1f53465e62a304dea21=
b99f910/src/cmd/go/internal/vcs/vcs.go#L1026-L1087
> +  (define-record-type <scs>
> +    (make-scs url-prefix root-regex type)
> +    scs?
> +    (url-prefix	scs-url-prefix)
> +    (root-regex scs-root-regex)
> +    (type	scs-type))

Maybe VCS as =E2=80=9Cversion control system=E2=80=9D?  (It took me a while=
 to guess
what =E2=80=9CSCS=E2=80=9D meant.)

> +(define (fetch-module-meta-data module-path)
> +  "Fetches module meta-data from a module's landing page. This is necess=
ary
> +because goproxy servers don't currently provide all the information need=
ed to
> +build a package."
> +  (let* ((port (http-fetch (string->uri (format #f "https://~a?go-get=3D=
1" module-path))))
> +         (module-metadata #f)
> +         (meta-tag-prefix "<meta name=3D\"go-import\" content=3D\"")
> +         (meta-tag-prefix-length (string-length meta-tag-prefix)))
> +    (do ((line (read-line port) (read-line port)))
> +        ((or (eof-object? line)
> +             module-metadata))
> +      (let ((meta-tag-index (string-contains line meta-tag-prefix)))
> +        (when meta-tag-index
> +          (let* ((start (+ meta-tag-index meta-tag-prefix-length))
> +                 (end (string-index line #\" start)))
> +            (set! module-metadata
> +              (string-split (substring/shared line start end) #\space)))=
)))

I=E2=80=99d suggest a named =E2=80=98let=E2=80=99 or =E2=80=98fold=E2=80=99=
 here.

Likewise, instead of concatenating XML strings (which could lead to
malformed XML), I recommend using SXML: you would create an sexp like

  (meta (@ (name "go-import") (content =E2=80=A6)))

and at the end pass it to =E2=80=98sxml->sxml=E2=80=99 (info "(guile) Readi=
ng and
Writing XML").

> +    (else
> +     (raise-exception (format #f "unsupported scs type: ~a" scs-type)))))

=E2=80=98raise-exception=E2=80=99 takes an error condition.  In this case, =
we should use
(srfi srfi-34) for =E2=80=98raise=E2=80=99 write something like:

  (raise (condition (formatted-message (G_ "=E2=80=A6" =E2=80=A6))))

> +(define* (go-module->guix-package module-path #:key (goproxy-url "https:=
//proxy.golang.org"))
> +  (call-with-temporary-output-file
> +   (lambda (temp port)
> +     (let* ((latest-version (fetch-latest-version goproxy-url module-pat=
h))
> +            (go.mod-path (fetch-go.mod goproxy-url module-path latest-ve=
rsion
> +                                       temp))

It seems that =E2=80=98go.mod-path=E2=80=99 isn=E2=80=99t used, and thus =
=E2=80=98fetch-go.mod=E2=80=99 &
co. aren=E2=80=99t used either, or am I overlooking something?

> +            (dependencies (map car (parse-go.mod temp)))

Please use =E2=80=98match=E2=80=99 instead, or perhaps define a record type=
 for the
abstraction at hand.

> +            (guix-name (to-guix-package-name module-path))
> +            (root-module-path (infer-module-root module-path))
> +            ;; SCS type and URL are not included in goproxy information.=
 For
> +            ;; this we need to fetch it from the official module page.
> +            (meta-data (fetch-module-meta-data root-module-path))
> +            (scs-type (module-meta-data-scs meta-data))
> +            (scs-repo-url (module-meta-data-repo-url meta-data goproxy-u=
rl)))
> +       (values
> +        `(package
> +           (name ,guix-name)
> +           ;; Elide the "v" prefix Go uses
> +           (version ,(string-trim latest-version #\v))
> +           (source
> +            ,(source-uri scs-type scs-repo-url temp))
> +           (build-system go-build-system)
> +           ,@(maybe-inputs (map to-guix-package-name dependencies))
> +           ;; TODO(katco): It would be nice to make an effort to fetch t=
his
> +           ;; from known forges, e.g. GitHub
> +           (home-page ,(format #f "https://~a" root-module-path))
> +           (synopsis "A Go package")
> +           (description ,(format #f "~a is a Go package." guix-name))

Maybe something like =E2=80=9Cfill it out!=E2=80=9D so we don=E2=80=99t get=
 patch submissions
with the default synopsis/description.  :-)

> +           (license #f))

Likewise.

Two more things: could you (1) and an entry under =E2=80=9CInvoking guix im=
port=E2=80=9D
in doc/guix.texi, and (2) add tests, taking inspiration from the
existing importer tests?

Thank you!

Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 23 Oct 2020 14:07:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 23 10:07:14 2020
Received: from localhost ([127.0.0.1]:57927 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kVxin-0007cI-I6
	for submit <at> debbugs.gnu.org; Fri, 23 Oct 2020 10:07:14 -0400
Received: from lists.gnu.org ([209.51.188.17]:53784)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <cox.katherine.e@HIDDEN>) id 1kVxil-0007cA-0o
 for submit <at> debbugs.gnu.org; Fri, 23 Oct 2020 10:07:07 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:36654)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <cox.katherine.e@HIDDEN>)
 id 1kVxik-0000iM-Rx
 for guix-patches@HIDDEN; Fri, 23 Oct 2020 10:07:06 -0400
Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]:41332)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <cox.katherine.e@HIDDEN>)
 id 1kVxii-0007AU-26
 for guix-patches@HIDDEN; Fri, 23 Oct 2020 10:07:06 -0400
Received: by mail-il1-x130.google.com with SMTP id w17so1461012ilg.8
 for <guix-patches@HIDDEN>; Fri, 23 Oct 2020 07:07:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:user-agent:mime-version;
 bh=uyjhv6K/f097J75OsRfsyDtv4uU4brSBk+/EuWxGjPI=;
 b=qDOpGWxL8hmmEXsmarrpLyyVRNsgle6lHQ4SUFxfWMOMpXoGhrP5Y/YIVOMz7WOSje
 gGq41lpWnLzP3wvZFIN3KMdT7H9lrpjjLQg+Ue5BzDrvmVN1+uouoARfpuVhLpZFIMao
 q4qMjqJh3MghTAUXIL6nHsMJKj+lhLPHLRLuDDZv4paZ91gKLmqePqjZSgDRvYTijFZ/
 6toIr7QDexToUVMfTzMq80iU5eX9cIh0BuI/Gqn1Q4fEbA7WS+xuycolQ6d4RcWERCIm
 JSRJ8QGU5QWiyn0vTS8wn+UBwtDi1LdkGt9x5oyQQMTtA+28Ji8VnWdrHQ91F6hNqg6a
 mAEA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:user-agent
 :mime-version;
 bh=uyjhv6K/f097J75OsRfsyDtv4uU4brSBk+/EuWxGjPI=;
 b=Pnu9svffzmMftqOwmTZ6eCFDhhfqwOTmL8K+WkMideHSyKLr0OOen8PQTbG5DazhkA
 7HJZdoSCgL/zRu/DoEZICAbP2JAWJMFZG7tAsbuZRF1GjQZFZhFDP8U6Bi667X4ZZwDP
 9bKMax5yEZpDuGPI8k+3klmS6Ebch+lKAtxz/cDB5C38jJBmP7UairJ4wFmxHB0tzWR1
 nQEbTj0Pb/+QqHCls2CfKyuD1+nSGgCZ0iMARFg3fFRGi61hhjKx+AhVp1L9zAiGze+3
 xvXh6ib3Ym8M7YVcEjRpqcFVLt7hnwpcXH2J0bUjuJiVg651ss+Md7t0RedwFrxoyPkO
 SdWg==
X-Gm-Message-State: AOAM530Sq1WGVwZPFV1PInVcPLZTgjgHC7JUcluWEBPHPK0V6AbepHB9
 JFn02I+eX5TOpf0Vgj65P85HqM5h9D/t4Q==
X-Google-Smtp-Source: ABdhPJwfzRxnccMMmCEJl4PzPVrYqW/IrhfFCoRkp+SxEa1zSFBA/pskk0kbXrJGJrT3j21fWovYFQ==
X-Received: by 2002:a92:d28b:: with SMTP id p11mr1841370ilp.264.1603462020810; 
 Fri, 23 Oct 2020 07:07:00 -0700 (PDT)
Received: from washu-v4 (172-221-246-205.res.spectrum.com. [172.221.246.205])
 by smtp.gmail.com with ESMTPSA id
 g26sm692059ion.25.2020.10.23.07.06.59 for <guix-patches@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 23 Oct 2020 07:06:59 -0700 (PDT)
From: Katherine Cox-Buday <cox.katherine.e@HIDDEN>
To: guix-patches@HIDDEN
Subject: Add a Go Module Importer
Date: Fri, 23 Oct 2020 09:06:58 -0500
Message-ID: <87sga5kpdp.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2607:f8b0:4864:20::130;
 envelope-from=cox.katherine.e@HIDDEN; helo=mail-il1-x130.google.com
X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache.
 That's all we know.
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
Content-Type: text/x-patch; charset=utf-8
Content-Disposition: inline;
 filename=0001-guix-import-go.scm-Created-Go-Importer.patch
Content-Transfer-Encoding: quoted-printable

From cc92cbcf5ae89891f478f319e955419800bdfcf9 Mon Sep 17 00:00:00 2001
From: Katherine Cox-Buday <cox.katherine.e@HIDDEN>
Date: Thu, 22 Oct 2020 19:40:17 -0500
Subject: [PATCH] * guix/import/go.scm: Created Go Importer *
 guix/scripts/import.scm: Created Go Importer Subcommand * guix/import/go.s=
cm
 (importers): Added Go Importer Subcommand

---
 guix/import/go.scm         | 276 +++++++++++++++++++++++++++++++++++++
 guix/scripts/import.scm    |   2 +-
 guix/scripts/import/go.scm | 118 ++++++++++++++++
 3 files changed, 395 insertions(+), 1 deletion(-)
 create mode 100644 guix/import/go.scm
 create mode 100644 guix/scripts/import/go.scm

diff --git a/guix/import/go.scm b/guix/import/go.scm
new file mode 100644
index 0000000000..61009f3565
--- /dev/null
+++ b/guix/import/go.scm
@@ -0,0 +1,276 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright =C2=A9 2020 Katherine Cox-Buday <cox.katherine.e@HIDDEN>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix import go)
+  #:use-module (ice-9 match)
+  #:use-module (ice-9 rdelim)
+  #:use-module (ice-9 receive)
+  #:use-module (ice-9 regex)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-9)
+  #:use-module (guix json)
+  #:use-module ((guix download) #:prefix download:)
+  #:use-module (guix import utils)
+  #:use-module (guix import json)
+  #:use-module (guix packages)
+  #:use-module (guix upstream)
+  #:use-module (guix utils)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix base16)
+  #:use-module (guix base32)
+  #:use-module (guix build download)
+  #:use-module (web uri)
+
+  #:export (go-module->guix-package
+            go-module-recursive-import
+            infer-module-root))
+
+(define (escape-capital-letters s)
+  "To avoid ambiguity when serving from case-insensitive file systems, the
+$module and $version elements are case-encoded by replacing every uppercase
+letter with an exclamation mark followed by the corresponding lower-case
+letter."
+  (let ((escaped-string (string)))
+    (string-for-each-index
+     (lambda (i)
+       (let ((c (string-ref s i)))
+         (set! escaped-string
+           (string-concatenate
+            (list escaped-string
+                  (if (char-upper-case? c) "!" "")
+                  (string (char-downcase c)))))))
+     s)
+    escaped-string))
+
+(define (fetch-latest-version goproxy-url module-path)
+  "Fetches the version number of the latest version for MODULE-PATH from t=
he
+given GOPROXY-URL server."
+  (assoc-ref
+   (json-fetch (format #f "~a/~a/@latest" goproxy-url
+                       (escape-capital-letters module-path)))
+   "Version"))
+
+(define (fetch-go.mod goproxy-url module-path version file)
+  "Fetches go.mod from the given GOPROXY-URL server for the given MODULE-P=
ATH
+and VERSION."
+  (url-fetch (format #f "~a/~a/@v/~a.mod" goproxy-url
+                     (escape-capital-letters module-path)
+                     (escape-capital-letters version))
+             file
+             #:print-build-trace? #f))
+
+(define (parse-go.mod go.mod-path)
+  "Parses a go.mod file and returns an alist of module path to version."
+  (with-input-from-file go.mod-path
+    (lambda ()
+      (let ((in-require? #f)
+            (requirements (list)))
+        (do ((line (read-line) (read-line)))
+            ((eof-object? line))
+          (set! line (string-trim line))
+          ;; The parser is either entering, within, exiting, or after the
+          ;; require block. The Go toolchain is trustworthy so edge-cases =
like
+          ;; double-entry, etc. need not complect the parser.
+          (cond
+           ((string=3D? line "require (")
+            (set! in-require? #t))
+           ((and in-require? (string=3D? line ")"))
+            (set! in-require? #f))
+           (in-require?
+            (let* ((requirement (string-split line #\space))
+                   ;; Modules should be unquoted
+                   (module-path (string-delete #\" (car requirement)))
+                   (version (list-ref requirement 1)))
+              (set! requirements (acons module-path version requirements))=
))
+           ((string-prefix? "replace" line)
+            (let* ((requirement (string-split line #\space))
+                   (module-path (list-ref requirement 1))
+                   (new-module-path (list-ref requirement 3))
+                   (version (list-ref requirement 4)))
+              (set! requirements (assoc-remove! requirements module-path))
+              (set! requirements (acons new-module-path version requiremen=
ts))))))
+        requirements))))
+
+(define (module-path-without-major-version module-path)
+  "Go modules can be appended with a major version indicator,
+e.g. /v3. Sometimes it is desirable to work with the root module path. For
+instance, for a module path github.com/foo/bar/v3 this function returns
+github.com/foo/bar."
+  (let ((m (string-match "(.*)\\/v[0-9]+$" module-path)))
+    (if m
+        (match:substring m 1)
+        module-path)))
+
+(define (infer-module-root module-path)
+  "Go modules can be defined at any level of a repository's tree, but quer=
ying
+for the meta tag usually can only be done at the webpage at the root of the
+repository. Therefore, it is sometimes necessary to try and derive a modul=
e's
+root path from its path. For a set of well-known forges, the pattern of wh=
at
+consists of a module's root page is known before hand."
+  ;; See the following URL for the official Go equivalent:
+  ;; https://github.com/golang/go/blob/846dce9d05f19a1f53465e62a304dea21b9=
9f910/src/cmd/go/internal/vcs/vcs.go#L1026-L1087
+  (define-record-type <scs>
+    (make-scs url-prefix root-regex type)
+    scs?
+    (url-prefix	scs-url-prefix)
+    (root-regex scs-root-regex)
+    (type	scs-type))
+  (let* ((known-scs
+          (list
+           (make-scs
+            "github.com"
+            "^(github\\.com/[A-Za-z0-9_.\\-]+/[A-Za-z0-9_.\\-]+)(/[A-Za-z0=
-9_.\\-]+)*$"
+            'git)
+           (make-scs
+            "bitbucket.org"
+            "^(bitbucket\\.org/([A-Za-z0-9_.\\-]+/[A-Za-z0-9_.\\-]+))(/[A-=
Za-z0-9_.\\-]+)*$`"
+            'unknown)
+           (make-scs
+            "hub.jazz.net/git/"
+            "^(hub\\.jazz\\.net/git/[a-z0-9]+/[A-Za-z0-9_.\\-]+)(/[A-Za-z0=
-9_.\\-]+)*$"
+            'git)
+           (make-scs
+            "git.apache.org"
+            "^(git\\.apache\\.org/[a-z0-9_.\\-]+\\.git)(/[A-Za-z0-9_.\\-]+=
)*$"
+            'git)
+           (make-scs
+            "git.openstack.org"
+            "^(git\\.openstack\\.org/[A-Za-z0-9_.\\-]+/[A-Za-z0-9_.\\-]+)(=
\\.git)?(/[A-Za-z0-9_.\\-]+)*$"
+            'git)))
+         (scs (find (lambda (scs) (string-prefix? (scs-url-prefix scs) mod=
ule-path))
+                    known-scs)))
+    (if scs
+        (match:substring (string-match (scs-root-regex scs) module-path) 1)
+        module-path)))
+
+(define (to-guix-package-name module-path)
+  "Converts a module's path to the canonical Guix format for Go packages."
+  (string-downcase
+   (string-append "go-"
+                  (string-replace-substring
+                   (string-replace-substring
+                    ;; Guix has its own field for version
+                    (module-path-without-major-version module-path)
+                    "." "-")
+                   "/" "-"))))
+
+(define (fetch-module-meta-data module-path)
+  "Fetches module meta-data from a module's landing page. This is necessary
+because goproxy servers don't currently provide all the information needed=
 to
+build a package."
+  (let* ((port (http-fetch (string->uri (format #f "https://~a?go-get=3D1"=
 module-path))))
+         (module-metadata #f)
+         (meta-tag-prefix "<meta name=3D\"go-import\" content=3D\"")
+         (meta-tag-prefix-length (string-length meta-tag-prefix)))
+    (do ((line (read-line port) (read-line port)))
+        ((or (eof-object? line)
+             module-metadata))
+      (let ((meta-tag-index (string-contains line meta-tag-prefix)))
+        (when meta-tag-index
+          (let* ((start (+ meta-tag-index meta-tag-prefix-length))
+                 (end (string-index line #\" start)))
+            (set! module-metadata
+              (string-split (substring/shared line start end) #\space))))))
+    (close-port port)
+    module-metadata))
+
+(define (module-meta-data-scs meta-data)
+  "Return the source control system specified by a module's meta-data."
+  (string->symbol (list-ref meta-data 1)))
+
+(define (module-meta-data-repo-url meta-data goproxy-url)
+  "Return the URL where the fetcher which will be used can download the so=
urce
+control."
+  (if (member (module-meta-data-scs meta-data) '(fossil mod))
+      goproxy-url
+      (list-ref meta-data 2)))
+
+(define (source-uri scs-type scs-repo-url file)
+  "Generate the `origin' block of a package depending on what type of sour=
ce
+control system is being used."
+  (case scs-type
+    ((git)
+     `(origin
+        (method git-fetch)
+        (uri (git-reference
+              (url ,scs-repo-url)
+              (commit (string-append "v" version))))
+        (file-name (git-file-name name version))
+        (sha256
+         (base32
+          ,(guix-hash-url file)))))
+    ((hg)
+     `(origin
+        (method hg-fetch)
+        (uri (hg-reference
+              (url ,scs-repo-url)
+              (changeset ,version)))
+        (file-name (format #f "~a-~a-checkout" name version))))
+    ((svn)
+     `(origin
+        (method svn-fetch)
+        (uri (svn-reference
+              (url ,scs-repo-url)
+              (revision (string->number version))
+              (recursive? #f)))
+        (file-name (format #f "~a-~a-checkout" name version))
+        (sha256
+         (base32
+          ,(guix-hash-url file)))))
+    (else
+     (raise-exception (format #f "unsupported scs type: ~a" scs-type)))))
+
+(define* (go-module->guix-package module-path #:key (goproxy-url "https://=
proxy.golang.org"))
+  (call-with-temporary-output-file
+   (lambda (temp port)
+     (let* ((latest-version (fetch-latest-version goproxy-url module-path))
+            (go.mod-path (fetch-go.mod goproxy-url module-path latest-vers=
ion
+                                       temp))
+            (dependencies (map car (parse-go.mod temp)))
+            (guix-name (to-guix-package-name module-path))
+            (root-module-path (infer-module-root module-path))
+            ;; SCS type and URL are not included in goproxy information. F=
or
+            ;; this we need to fetch it from the official module page.
+            (meta-data (fetch-module-meta-data root-module-path))
+            (scs-type (module-meta-data-scs meta-data))
+            (scs-repo-url (module-meta-data-repo-url meta-data goproxy-url=
)))
+       (values
+        `(package
+           (name ,guix-name)
+           ;; Elide the "v" prefix Go uses
+           (version ,(string-trim latest-version #\v))
+           (source
+            ,(source-uri scs-type scs-repo-url temp))
+           (build-system go-build-system)
+           ,@(maybe-inputs (map to-guix-package-name dependencies))
+           ;; TODO(katco): It would be nice to make an effort to fetch this
+           ;; from known forges, e.g. GitHub
+           (home-page ,(format #f "https://~a" root-module-path))
+           (synopsis "A Go package")
+           (description ,(format #f "~a is a Go package." guix-name))
+           (license #f))
+        dependencies)))))
+
+(define* (go-module-recursive-import package-name
+                                     #:key (goproxy-url "https://proxy.gol=
ang.org"))
+  (recursive-import package-name #f
+                    #:repo->guix-package
+                    (lambda (name _)
+                      (go-module->guix-package name
+                                               #:goproxy-url goproxy-url))
+                    #:guix-name to-guix-package-name))
diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm
index 0a3863f965..1d2b45d942 100644
--- a/guix/scripts/import.scm
+++ b/guix/scripts/import.scm
@@ -77,7 +77,7 @@ rather than \\n."
 ;;;
=20
 (define importers '("gnu" "nix" "pypi" "cpan" "hackage" "stackage" "elpa" =
"gem"
-                    "cran" "crate" "texlive" "json" "opam"))
+                    "go" "cran" "crate" "texlive" "json" "opam"))
=20
 (define (resolve-importer name)
   (let ((module (resolve-interface
diff --git a/guix/scripts/import/go.scm b/guix/scripts/import/go.scm
new file mode 100644
index 0000000000..000039769c
--- /dev/null
+++ b/guix/scripts/import/go.scm
@@ -0,0 +1,118 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright =C2=A9 2020 Katherine Cox-Buday <cox.katherine.e@HIDDEN>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix scripts import go)
+  #:use-module (guix ui)
+  #:use-module (guix utils)
+  #:use-module (guix scripts)
+  #:use-module (guix import go)
+  #:use-module (guix scripts import)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-11)
+  #:use-module (srfi srfi-37)
+  #:use-module (ice-9 match)
+  #:use-module (ice-9 format)
+  #:export (guix-import-go))
+
+
+;;;
+;;; Command-line options.
+;;;
+
+(define %default-options
+  '())
+
+(define (show-help)
+  (display (G_ "Usage: guix import go PACKAGE-PATH
+Import and convert the Go module for PACKAGE-PATH.\n"))
+  (display (G_ "
+  -h, --help             display this help and exit"))
+  (display (G_ "
+  -V, --version          display version information and exit"))
+  (display (G_ "
+  -r, --recursive        generate package expressions for all Go modules\
+ that are not yet in Guix"))
+  (display (G_ "
+  -p, --goproxy=3DGOPROXY  specify which goproxy server to use"))
+  (newline)
+  (show-bug-report-information))
+
+(define %options
+  ;; Specification of the command-line options.
+  (cons* (option '(#\h "help") #f #f
+                 (lambda args
+                   (show-help)
+                   (exit 0)))
+         (option '(#\V "version") #f #f
+                 (lambda args
+                   (show-version-and-exit "guix import go")))
+         (option '(#\r "recursive") #f #f
+                 (lambda (opt name arg result)
+                   (alist-cons 'recursive #t result)))
+         (option '(#\p "goproxy") #t #f
+                 (lambda (opt name arg result)
+                   (alist-cons 'goproxy
+                               (string->symbol arg)
+                               (alist-delete 'goproxy result))))
+         %standard-import-options))
+
+
+;;;
+;;; Entry point.
+;;;
+
+(define (guix-import-go . args)
+  (define (parse-options)
+    ;; Return the alist of option values.
+    (args-fold* args %options
+                (lambda (opt name arg result)
+                  (leave (G_ "~A: unrecognized option~%") name))
+                (lambda (arg result)
+                  (alist-cons 'argument arg result))
+                %default-options))
+
+  (let* ((opts (parse-options))
+         (args (filter-map (match-lambda
+                             (('argument . value)
+                              value)
+                             (_ #f))
+                           (reverse opts))))
+    (match args
+      ((module-name)
+       (if (assoc-ref opts 'recursive)
+           (map (match-lambda
+                  ((and ('package ('name name) . rest) pkg)
+                   `(define-public ,(string->symbol name)
+                      ,pkg))
+                  (_ #f))
+                (go-module-recursive-import module-name
+                                            #:goproxy-url
+                                            (or (assoc-ref opts 'goproxy)
+                                                "https://proxy.golang.org"=
)))
+           (let ((sexp (go-module->guix-package module-name
+                                                #:goproxy-url
+                                                (or (assoc-ref opts 'gopro=
xy)
+                                                    "https://proxy.golang.=
org"))))
+             (unless sexp
+               (leave (G_ "failed to download meta-data for module '~a'~%")
+                      module-name))
+             sexp)))
+      (()
+       (leave (G_ "too few arguments~%")))
+      ((many ...)
+       (leave (G_ "too many arguments~%"))))))
--=20
2.28.0


--=-=-=
Content-Type: text/plain


-- 
Katherine

--=-=-=--




Acknowledgement sent to Katherine Cox-Buday <cox.katherine.e@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#44178; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 29 Jan 2021 17:00:02 UTC

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