From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id wGV6I8wC2GCCfAEAgWs5BA (envelope-from ) for ; Sun, 27 Jun 2021 06:47:08 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id NW8pH8wC2GAJCgAA1q6Kng (envelope-from ) for ; Sun, 27 Jun 2021 04:47:08 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C0C7D2036C for ; Sun, 27 Jun 2021 06:47:07 +0200 (CEST) Received: from localhost ([::1]:40602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lxMhG-000666-Ih for larch@yhetil.org; Sun, 27 Jun 2021 00:47:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49918) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lxMhC-00065i-NE for guix-patches@gnu.org; Sun, 27 Jun 2021 00:47:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37302) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lxMhC-00023p-F3 for guix-patches@gnu.org; Sun, 27 Jun 2021 00:47:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lxMhC-0007cy-AL for guix-patches@gnu.org; Sun, 27 Jun 2021 00:47:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49196] [PATCH] import: utils: 'recursive-import' skips unfound packages Resent-From: Sarah Morgensen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 27 Jun 2021 04:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49196 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: zimoun Cc: 49196@debbugs.gnu.org Received: via spool by 49196-submit@debbugs.gnu.org id=B49196.162476917829255 (code B ref 49196); Sun, 27 Jun 2021 04:47:02 +0000 Received: (at 49196) by debbugs.gnu.org; 27 Jun 2021 04:46:18 +0000 Received: from localhost ([127.0.0.1]:48848 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lxMgU-0007bn-Ip for submit@debbugs.gnu.org; Sun, 27 Jun 2021 00:46:18 -0400 Received: from out0.migadu.com ([94.23.1.103]:15466) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lxMgQ-0007ba-W2 for 49196@debbugs.gnu.org; Sun, 27 Jun 2021 00:46:16 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1624769173; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=nW+ClB8sH82z4vMSs1ALt9u7zG0xgSl8hvUzNP4e5hg=; b=dJOsjli+48Lz8WAaJV9lnYLoLO3WKPHwyATVd+4dm8yVrSaRmRANHxy4K+I8yXJlMfWMhN MenBpBu9LdxTxJq0I3POZZ+lF5C5VPk9+eDW4QvEPtyp9B8isSBswOJRRPECh8d76Hq22M FzA6Eg76rELDkV1QfsaNfYxKtEw28os= References: <20210625163749.65196-1-zimon.toutoune@gmail.com> <20210625163749.65196-3-zimon.toutoune@gmail.com> Date: Sat, 26 Jun 2021 21:46:10 -0700 In-Reply-To: <20210625163749.65196-3-zimon.toutoune@gmail.com> (zimoun's message of "Fri, 25 Jun 2021 18:37:49 +0200") Message-ID: <868s2v7w4t.fsf_-_@mgsn.dev> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Auth-User: iskarian@mgsn.dev X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" Reply-to: Sarah Morgensen X-ACL-Warn: , Sarah Morgensen via Guix-patches From: Sarah Morgensen via Guix-patches via X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1624769228; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=nW+ClB8sH82z4vMSs1ALt9u7zG0xgSl8hvUzNP4e5hg=; b=WxqPMOAvrPQrrMZVp3YHkAK/yF1IHffqNxZT3jg/EqzGtIfDBJc6bNumvVBQtS/VdCIhJw fOlTt5/U31DtgD2CAwaNRBpDuqHP6VvhH+ILlKXbdU0c4E/WQoOYiSdVFI75Ir5MDSy+m5 os130XRtXtPfRjgIrC32qT+4CLTZcKD/fFAwpF3rsJC+iO4UzvmBwiQtlDjqT8DqhUf4Ji lg/O8Zmn+NBxQMlpkXs8qQsODDOuzVcFahYsmFVsGDXvV4QTAnJ3xL0nEpPtS2pzhXARPU TLAwLjRnfcVcDteadBxyo/4IXWDACEthBz6IjWYKdR7vEcmkRWv74SGorB0GXQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624769228; a=rsa-sha256; cv=none; b=eXkcaEdwoRld4sXP1xpdB6Q+VNsFwHeITcWNdD8C6pnJrlNjLnpXeZBzyG9zuG/KKhJmYb oOlBkOoZayfnLI5X5eaZExrry1lGmOxuhn5uqVTiTeGlXQqCp0OiLfOltzaVZPHnqTTGdq 9SG0GvXjQCqszWMF4nYPndQwA4887L0N7V7kNsQuSxdasR8BZqemnplPQDwVPhs1ZXbVMf eEojoc3ivivzBH3giSxkS/yPojo46uFMl8jwylvCQIrqplZRAEFFh5xMpya4taaQyXdhO2 IL62c9YboK6Y9zIkGRbRQKUlNXJDNKEQ6qYcDLEY0YPuqjbgLv7+GnzQxNp71w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=dJOsjli+; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -2.93 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=dJOsjli+; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: C0C7D2036C X-Spam-Score: -2.93 X-Migadu-Scanner: scn1.migadu.com X-TUID: EpsUIngESCow Hi, Apologies for the delay. Thanks for the work. zimoun writes: > - #:export (go-module->guix-package > + #:export (go-module->guix-package* Would it be better to export both, in case a callee wants access to the actual errors? > +(define go-module->guix-package* > + (memoize > + (lambda args I would remove the memoize from this method (to put it back in later on), because multiple invocations with errors would only yield one error reported. I do not think this makes sense if another tool is using this. > + (else > + (warning (G_ "Something went wrong with ~s.~%") args) A catch-all is fine, but we should at least report the actual error, even if it's not pretty: (warning (G_ "Failed to import package ~s.~% reason: ~s") package-name (exception-args c)) However, if we want to move in the direction of proper error handling like guix/packages.scm and guix/ui.scm, we can do something like... --8<---------------cut here---------------start------------->8--- (define (report-import-error package-name error) (cond ((http-get-error? error) [...] (else [...])))) (define* (go-module->guix-package* module-path #:key (on-error report-import-error) #:allow-other-keys #:rest args) (with-exception-handler (lambda (error) (on-error module-path error) (values #f '())) (lambda () (apply go-module->guix-package module-path args)) #:unwind? #t)) (define* (go-module-recursive-import package-name #:key (goproxy "https://proxy.golang.org") version pin-versions?) (recursive-import package-name #:repo->guix-package (memoize (lambda* (name #:key version repo) (go-module->guix-package* name #:goproxy goproxy #:version version #:pin-versions? pin-versions?))) #:guix-name go-module->guix-package-name #:version version)) --8<---------------cut here---------------end--------------->8--- Looks like I got a little carried away :) But breaking out the error reporting gives us the future option of "plugging in" other error reporting strategies, such as collating them and returning them alongside a programmatic recursive import, or being able to provide a list of packages which failed to import at the end. This will be much more useful once we have a proper set of import error conditions. Too much, perhaps? Sarah