From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leo Famulari Subject: Go packaging Date: Tue, 3 Oct 2017 11:15:04 -0400 Message-ID: <20171003151504.GA27166@jasmine.lan> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="fUYQa+Pmc3FrFX/N" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42139) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dzOue-0000G7-N7 for guix-devel@gnu.org; Tue, 03 Oct 2017 11:15:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dzOuY-0003pc-NS for guix-devel@gnu.org; Tue, 03 Oct 2017 11:15:12 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:50853) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dzOuY-0003ob-Bk for guix-devel@gnu.org; Tue, 03 Oct 2017 11:15:06 -0400 Received: from localhost (c-73-165-108-70.hsd1.pa.comcast.net [73.165.108.70]) by mail.messagingengine.com (Postfix) with ESMTPA id 272137F9D2 for ; Tue, 3 Oct 2017 11:15:05 -0400 (EDT) Content-Disposition: inline List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org --fUYQa+Pmc3FrFX/N Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Based on my work creating a go-build-system and packaging a non-trivial Go application [0], I want to start a discussion on how we can efficiently package Go software in Guix. Go software is developed rather differently from most of what we package, and I think our package abstraction does not fit Go libraries well. The primary differences are 0) Go libraries are typically bundled as source code, 1) Go software is typically unversioned, 2) static archives (.a) are the norm, and 3) Go libraries are expected to be built as part of the build process of the calling application. That is, there is no standard way to build an entire Go library on its own. Elaboration: 0,1) The problem with every application bundling unversioned libraries is that we need to package a different Git commit of the library for every application we package, or risk our packages not working. Adding package variants per-version is a bit messy currently. 3) As an example of how Go libaries are built piecemeal, take the core networking library, 'golang.org/x/net' [1]. It includes dozens of submodules such as bpf, icmp, ipv4, ipv6, etc. There is no way to build all these submodules with a single command. Instead, each one is built when it is needed during the build process of the calling application. There are no build scripts. The library compilation process is standardized as, for example, `go install golang.org/x/net/ipv4`. This means that the entire networking library would consist of several dozen Guix packages, multiplied by the number of different Git commits required by the calling applications. It's unreasonable, in my opinion. My suggestion is that we have two layers of Go library packages: a) a template layer that includes the source URI, unpack-path, and other package metadata, and b) a layer to create instances of the package within the inputs field of the calling package. Perhaps the instantiation layer could look like this in practice: (define-public my-go-program [...] (inputs `(("golang.org/x/net" ,(go-package golang-org-x-net (version "ffcf1bedda") (import-paths '("golang.org/x/net/ipv4" "golang.org/x/net/context" "golang.org/x/net/ipv6" "golang.org/x/net/internal/iana"))))))) Or something like that. What do you think? [0] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28586#26 [1] https://godoc.org/golang.org/x/net --fUYQa+Pmc3FrFX/N Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAlnTqXQACgkQJkb6MLrK fwjZuRAAj57bE+YBWiXBQflL2DZ36stjRAGU8ySV0Ne4jX8UD8aN9q6Bio92IjDJ b+l0HluLSNYmdQnC8Es+DEKiGXB49OcSVGFXb/DdJWmRzEiy3TlFlg7Rk601EdN+ 6m6y8nDkiwgxq7jnFOwW4zk3bh5zrEKQ2zIiz1Jk0hJpijDKgZ06IQLOrS+C7ysw ZrooFfkGgt4kX+OLDGpdjTCvmPJFaz9UKObskQtRDJlRCHXY/rqDPbUXtgBLsGB2 6xflWICqVd13/5hnHAGfQGo7KcwolnIL0/9gHr89uOEFZGUtfIUrrJZahkCGrMd2 z+uLq8tVsldF5WedOT+c6LvssWle7bTbN3crRuCMmZyeMnGxCgb2S5+5C+ZkF3hG gK2KViEB2Hvy/ebgi4cBPF//EgxGsbl2icv0GjNsAf3Z3Gtw6kp8HJYhMxwdTqrM WQ814JfThFyfXLqGmeN52jutabXUlI4zbB1RB0owmFPNDBIbeAs0Ba6M/0vHe7cV EOa33DAmVPT0d5oBvQ0vLFF+rCJHw83VUl3w+v2eVmc2dg8ZILhjEOmsv0bR9wCd OMumLSG0C5/J906jslmYC1+BSYohlVoefhyoiPDxn0bQHZyYO4061IOOX+4/YXpj MXbWe8hs4t6vHOFHij8IWe5TlVXltLH8HS0OlN9uXLAy6wKxYrI= =6J22 -----END PGP SIGNATURE----- --fUYQa+Pmc3FrFX/N--