From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id UPBqNlBL+l83JQAA0tVLHw (envelope-from ) for ; Sun, 10 Jan 2021 00:33:20 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 8P0vMlBL+l9ZOQAAB5/wlQ (envelope-from ) for ; Sun, 10 Jan 2021 00:33:20 +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 779B99402A2 for ; Sun, 10 Jan 2021 00:33:19 +0000 (UTC) Received: from localhost ([::1]:49384 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kyOfV-0007F5-4p for larch@yhetil.org; Sat, 09 Jan 2021 19:33:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48178) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyOfF-0007Ek-3M for help-guix@gnu.org; Sat, 09 Jan 2021 19:33:01 -0500 Received: from smtp-out-3.mxes.net ([198.205.123.68]:40010) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyOfC-0006tf-F7 for help-guix@gnu.org; Sat, 09 Jan 2021 19:33:00 -0500 Received: from Customer-MUA (mua.mxes.net [10.0.0.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 4CE3D759C8; Sat, 9 Jan 2021 19:32:47 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mxes.net; s=mta; t=1610238769; bh=Vkl40mspjZzpCmVU/gCHer9uajoV2qSvvYMRSJAfNpg=; h=From:To:Subject:In-Reply-To:References:Date:From; b=IauMdJV5ZY3PydqZl+8c+vWzDgwOUaVzX0YaFOHKiAG5Cym0u1FC9iiFrGJKHdzwy XjDv2p+g4/rUtstPYMRIEJwaENY45qc58rldzGXD2XIyhy0Sa9Q9KbEGOFC5RRh6Li l41EKRZg6BbcsY28F/GuzCQ90CntfScG7EJ7IH18= From: Timmy Douglas To: Leo Famulari , help-guix@gnu.org, Katherine Cox-Buday , Helio Machado <0x2b3bfa0@gmail.com> Subject: Re: packaging a golang package In-Reply-To: <4bdbc469-ad45-4739-b001-739ad3a60adc@www.fastmail.com> References: <87h7nrud2a.fsf@timmydouglas.com> <4bdbc469-ad45-4739-b001-739ad3a60adc@www.fastmail.com> Date: Sat, 09 Jan 2021 16:32:45 -0800 Message-ID: <87a6thtyvm.fsf@timmydouglas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Sent-To: Received-SPF: none client-ip=198.205.123.68; envelope-from=mail+GN=1ae5c7e7@timmydouglas.com; helo=smtp-out-3.mxes.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -1.05 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=mxes.net header.s=mta header.b=IauMdJV5; dmarc=none; spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-Migadu-Queue-Id: 779B99402A2 X-Spam-Score: -1.05 X-Migadu-Scanner: scn1.migadu.com X-TUID: RH8lN1VBMIc2 "Leo Famulari" writes: > On Fri, Jan 8, 2021, at 02:01, Timmy Douglas wrote: >>=20 >> I recently installed guix for the first time and I wanted to try to >> package my first program. The one I decided to try is written in go and >> uses go.mod (https://github.com/coredns/coredns/blob/master/go.mod) for >> modules. Running `go build` would normally download those if they don't >> exist. >>=20 >> I took a look at a couple of other packages, and it looks like the right >> way to do it would be to package the individual modules as seen in >> guix/gnu/packages/golang.scm. Has anyone tried automating this sort of >> thing? There are almost 40 dependencies... > > Thanks for working on this! > > It's true, Go programs usually have a dependency graph that is > uncomfortably large =E2=80=94 although not impossibly large like Rust. > > There is a work-in-progress implementation of a Go package importer > that I believe should make it easier: > > https://issues.guix.gnu.org/issue/44178 > > You could try it out and, if it works for you, send those patches, and > give feedback on the importer as well :) Thanks for the pointer! I tried both Katherine's patch (with dftxbs3e's mini fix for recursive-import) and Helio's patch (with a git remote add/cherry-pick) and had trouble with both of them. I spent a little more time with Katherine's patch so I'll go into that more below. Part of the issue is that I haven't used Scheme in like 15 years (and when I did, it wasn't for anything non-trivial). But I'm also really struggling to debug what's going on: I run `make && ./pre-inst-env guix import go -r github.com/coredns/coredns`: Starting download of /tmp/guix-file.pZqXNO >From https://proxy.golang.org/k8s.io/klog/@v/v1.0.0.mod... v1.0.0.mod 68B 88KiB/s 00:00 [##################] 1= 00.0% metadata#f Backtrace: In ice-9/boot-9.scm: 1736:10 13 (with-exception-handler _ _ #:unwind? _ # _) In unknown file: 12 (apply-smob/0 #) In ice-9/boot-9.scm: 718:2 11 (call-with-prompt _ _ #) In ice-9/eval.scm: 619:8 10 (_ #(#(#))) 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: 468: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: 457:33 4 (lookup-node "k8s.io/klog" #f) In guix/utils.scm: 703:8 3 (call-with-temporary-output-file #) In ice-9/eval.scm: 293:34 2 (_ #(#(#(#(#(#(#(#(# ?) ?) ?) ?) ?) ?) ?) ?)) 155:9 1 (_ #(#(#) #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 I understand that (list-ref #f 1) won't work, but I can't figure out where that code is based on the information in the backtrace. Seems like the variables/symbols/filenames are missing everywhere where it counts. I loaded the code up with #'display and found that I needed to add another git scs/vcs entry for k8s.io, and that the fetch-module-meta-data method tries to use regexes to parse html: root-module-path=3D k8s.io/klog line=3D line=3D line=3D line=3D line=3D line=3D (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 "