From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id 8EnwAiZ43mQ8lgAASxT56A (envelope-from ) for ; Thu, 17 Aug 2023 21:42:30 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id CJ4LAyZ43mTuogAA9RJhRA (envelope-from ) for ; Thu, 17 Aug 2023 21:42:30 +0200 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 86A665AF7A for ; Thu, 17 Aug 2023 21:42:29 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=kW4YZIPl; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1692301349; a=rsa-sha256; cv=none; b=SPrh50R8toMzPqMGbX7NTkoSNlAcQXgEMTlhKvqM7eieDPuU6HcHIuLmOLQq1mxZC4TIj3 dCJmIP9zOBGDPkUzKCBNKNGMPva3rYHeg9czq24BZtLH3aHmHrlJhFTeRXwKEbUyJ3LRs8 nDjOcHE8j3L2V3uNVucSQek/mKJS1KqwERTh7i4/eEuoqHTOLMPxQ1SfdWXs91K42XXiyX mNqbNJtRrDMdJBXXBCFELeVU1lxBPZ4iN247C7gLYVIe/GVSFjHB71IaC0Yq7B1zLNAssx KusVXUK8w2Kc06lMorrAi9EZ/oMhWl0scAZ5w63IDJ20RkBY3Bpy0ySzHbi3QQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=kW4YZIPl; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1692301349; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: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=CcGzzH4K9Z0FFOY2Aw87o9lyaopZu6eenahelcCor90=; b=Br069sgwEP477VQHp6x//Loye/Yr10Dzu3yTnu+G+88UNRCn5OdV6D9PgVShVGwJXCeo18 VOdKMAwMCPL71U0XUx8RlXPdIU+2/cHMqsiTiMeKymLbcnSSYtqphOttfb77+9nuxdFi/z onO0rABystmK5cyc6JoKFxszpQRNrKdsSGVWiloYyTKvDbpVLbaev0tbCLNrVC4dax0RW1 1UJuzFOMe2zXsmznFdpDDB/Gm0jsGHJGqka+aN/4+I55PCSixkygVt/Oa+lLrh8cRzfX2f GR5AAu8VUzJJtZbSKNIGHxN9YC2Mkgp419pkE2h8c15euRFhQkADYF9vrZNXDQ== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWise-0006OU-Lc; Thu, 17 Aug 2023 15:42:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWisc-0006Nk-UL for guix-patches@gnu.org; Thu, 17 Aug 2023 15:42:02 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qWisc-0007M8-Kn for guix-patches@gnu.org; Thu, 17 Aug 2023 15:42:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qWisc-0005Nn-C6 for guix-patches@gnu.org; Thu, 17 Aug 2023 15:42:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65317] [PATCH v2 1/1] gnu: Add go-1.21. Resent-From: Katherine Cox-Buday Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 17 Aug 2023 19:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65317 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: moreinfo patch To: 65317@debbugs.gnu.org Received: via spool by 65317-submit@debbugs.gnu.org id=B65317.169230126320601 (code B ref 65317); Thu, 17 Aug 2023 19:42:02 +0000 Received: (at 65317) by debbugs.gnu.org; 17 Aug 2023 19:41:03 +0000 Received: from localhost ([127.0.0.1]:45658 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWire-0005Lz-2P for submit@debbugs.gnu.org; Thu, 17 Aug 2023 15:41:02 -0400 Received: from mail-ot1-x336.google.com ([2607:f8b0:4864:20::336]:52352) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWirb-0005LR-Lx for 65317@debbugs.gnu.org; Thu, 17 Aug 2023 15:41:00 -0400 Received: by mail-ot1-x336.google.com with SMTP id 46e09a7af769-6bca66e6c44so218314a34.0 for <65317@debbugs.gnu.org>; Thu, 17 Aug 2023 12:40:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692301253; x=1692906053; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=CcGzzH4K9Z0FFOY2Aw87o9lyaopZu6eenahelcCor90=; b=kW4YZIPlqcoBC09vqy3nZg3qjRYGjzH87HN1cUp5uuxJd3F/VpGFst3OF6qJmjF7uS UmGTd+dpw0HMHiW8AlwW2F3aYAZnwtIH3Lromxqd+IOW2zq/jCCnz3oDtirdVApyM5Wu /MCnaZ/w+z/jQITAQS5ndbCpg2kZM54aHyVxqFY+bz1bEevDUG8lyx49rkF39RjfYVrC LbKqdvZGpb+nXXFezJsN7JIF998kMA0gv5tKqaF9ou3oZNmZuApj+15Ea183avX5b+Ar e9iypgjvVuaIE+nBa/A6xRcchrHlEwXsrKUHph+5bbZh6WNtc7SnXUkYy8DgtPS2SFG5 9+NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692301253; x=1692906053; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CcGzzH4K9Z0FFOY2Aw87o9lyaopZu6eenahelcCor90=; b=ewlRtDSpNt52hR/K2vwRvG77yxpAtzzNFPhNuQi4zqnwJl1MB1jTApitRS+FO+RGVM IDrsalf2VBWPMJ94OP9W2tGTdDwwtGvy7KbPtXay4RzYsx6YcX8Vv28KW/T3kaJF9VE2 lZ0YuJtjBPH2lZcxhu9NV0acgdJH8bGLBCt5VA6gxx/Hi6HLY1UAr66G8CvP+JVjVEGT 6asBuopmlG5rEJySQ0YkCNZTEhc/IASgxj2J3n43xoIFxCr9ttgzPsMRjYwQ3oU7xkCJ 1hyY3wu5H0X5eSvytF8MuAn4xiYI/HpBuDEf+wZIrIVLkTTlPJ9gEnLkR5x7jOl3U5+z qp5g== X-Gm-Message-State: AOJu0YwV1nY2yx0YdspELRa9yg9xgbr/GTHWPzPjUKnlpZTiemdQOePT orru1vDWWrfWmyynD463vUkDtZenqXU= X-Google-Smtp-Source: AGHT+IGH+cY2Pjs6fFqu8P+EhHIWrEuO+Z0zqjzNP5FAvlAGy9fBLtjKEIhQ/kn2sPm9xDQvgJIhsw== X-Received: by 2002:a9d:74ca:0:b0:6bd:680:dc13 with SMTP id a10-20020a9d74ca000000b006bd0680dc13mr309844otl.21.1692301253527; Thu, 17 Aug 2023 12:40:53 -0700 (PDT) Received: from [10.0.2.153] (c-174-51-218-141.hsd1.co.comcast.net. [174.51.218.141]) by smtp.gmail.com with ESMTPSA id l12-20020a9d734c000000b006b9cc67386fsm176317otk.66.2023.08.17.12.40.50 for <65317@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Aug 2023 12:40:51 -0700 (PDT) Message-ID: <70b0c79d-060b-af95-d295-b23ec522b4a7@gmail.com> Date: Thu, 17 Aug 2023 13:40:50 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US References: <20230815195313.46418-1-cox.katherine.e@gmail.com> <20230815232142.79498-1-cox.katherine.e@gmail.com> From: Katherine Cox-Buday In-Reply-To: <20230815232142.79498-1-cox.katherine.e@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: 86A665AF7A X-Migadu-Scanner: mx0.migadu.com X-Migadu-Spam-Score: -2.09 X-Spam-Score: -2.09 X-TUID: mZAxz8lqf8o/ On 8/15/23 5:20 PM, Katherine Cox-Buday wrote: > * gnu/packages/golang.scm (go-1.21): New variable. > --- > gnu/packages/golang.scm | 132 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 132 insertions(+) > > diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm > index 5a53838435..26022ea211 100644 > --- a/gnu/packages/golang.scm > +++ b/gnu/packages/golang.scm > @@ -967,6 +967,138 @@ (define-public go-1.20 > ;; https://go.dev/issue/44505 > (alist-replace "go" (list go-1.17) (package-native-inputs go-1.17))))) > > +(define-public go-1.21 > + (package > + (inherit go-1.20) > + (name "go") > + (version "1.21.0") > + (source (origin > + (method git-fetch) > + (uri (git-reference > + (url "https://github.com/golang/go") > + (commit (string-append "go" version)))) > + (file-name (git-file-name name version)) > + (sha256 > + (base32 > + "04cpahl10i1sncymdfm0vzcj3czv6lv0axwa1sisl9cz3rdrp7hj")))) > + (arguments > + (substitute-keyword-arguments (package-arguments go-1.20) > + ;; Source patching phases are broken up into discrete steps to allow > + ;; future versions to discard individual phases without having to > + ;; discard all source patching. > + ((#:phases phases) > + #~(modify-phases #$phases > + (delete 'skip-TestGoPathShlibGccgo-tests) > + (delete 'patch-source) > + (add-after 'unpack 'patch-os-tests > + (lambda _ > + (substitute* "src/os/os_test.go" > + (("/usr/bin") (getcwd)) > + (("/bin/sh") (which "sh"))))) > + > + (add-after 'unpack 'apply-patches > + (lambda* (#:key inputs #:allow-other-keys) > + ;; Having the patch in the 'patches' field of breaks > + ;; the 'TestServeContent' test due to the fact that > + ;; timestamps are reset. Thus, apply it from here. > + (invoke "patch" "-p1" "--force" "-i" > + (assoc-ref inputs "go-fix-script-tests.patch")))) > + > + (add-after 'unpack 'patch-src/net > + (lambda* (#:key inputs #:allow-other-keys) > + (let ((net-base (assoc-ref inputs "net-base"))) > + (substitute* "src/net/lookup_unix.go" > + (("/etc/protocols") > + (string-append net-base "/etc/protocols"))) > + (substitute* "src/net/port_unix.go" > + (("/etc/services") > + (string-append net-base "/etc/services")))))) > + > + (add-after 'unpack 'patch-zoneinfo > + (lambda* (#:key inputs #:allow-other-keys) > + ;; Add the path to this specific version of tzdata's zoneinfo > + ;; file to the top of the list to search. We don't want to > + ;; replace any sources because it will affect how binaries > + ;; compiled with this Go toolchain behave on non-guix > + ;; platforms. > + (substitute* "src/time/zoneinfo_unix.go" > + (("var platformZoneSources.+" all) > + (format #f "~a~%\"~a/share/zoneinfo\",~%" > + all > + (assoc-ref inputs "tzdata")))))) > + > + (add-after 'unpack 'patch-cmd/go/testdata/script > + (lambda _ > + (substitute* "src/cmd/go/testdata/script/cgo_path_space.txt" > + (("/bin/sh") (which "sh"))))) > + > + (add-after 'enable-external-linking 'enable-external-linking-1.21 > + (lambda _ > + ;; Invoke GCC to link any archives created with GCC (that is, any > + ;; packages built using 'cgo'), because Go doesn't know how to > + ;; handle the runpaths but GCC does. Use substitute* rather than > + ;; a patch since these files are liable to change often. > + ;; > + ;; XXX: Replace with GO_EXTLINK_ENABLED=1 or similar when > + ;; and/or > + ;; are resolved. > + (substitute* "src/cmd/link/internal/ld/config.go" > + (("\\(iscgo && \\(.+\\)") "iscgo")) > + (substitute* "src/internal/testenv/testenv.go" > + (("!CanInternalLink.+") "true {\n")) > + (substitute* "src/syscall/exec_linux_test.go" > + (("testenv.MustHaveExecPath\\(t, \"whoami\"\\)") > + "t.Skipf(\"no passwd file present\")")))) > + > + (replace 'install > + (lambda* (#:key outputs #:allow-other-keys) > + ;; Notably, we do not install archives (180M), which Go will > + ;; happily recompile quickly (and cache) if needed, almost > + ;; surely faster than they could be substituted. > + ;; > + ;; The main motivation for pre-compiled archives is to use > + ;; libc-linked `net' or `os' packages without a C compiler, > + ;; but on Guix a C compiler is necessary to properly link the > + ;; final binaries anyway. Many build flags also invalidate > + ;; these pre-compiled archives, so in practice Go often > + ;; recompiles them anyway. > + ;; > + ;; Upstream is also planning to no longer install these > + ;; archives: > + ;; > + ;; When necessary, a custom pre-compiled library package can > + ;; be created with `#:import-path "std"' and used with > + ;; `-pkgdir'. > + ;; > + ;; When moving files into place, any files that come from > + ;; GOROOT should remain in GOROOT to continue functioning. If > + ;; they need to be referenced from some other directory, they > + ;; need to be symlinked from GOROOT. For more information, > + ;; please see https://github.com/golang/go/issues/61921 > + (let* ((out (assoc-ref outputs "out")) > + (tests (assoc-ref outputs "tests"))) > + (for-each > + (lambda (file) > + (copy-recursively file (string-append out "/lib/go/" file))) > + '("bin" "lib" "VERSION" "pkg/include" "pkg/tool")) We also need to install go.env here. See https://github.com/golang/go/issues/61928. There is also some new functionality outlined in the GOTOOLCHAIN environment variable that we need to consider. From https://go.dev/doc/toolchain : "The go command can use its bundled Go toolchain as well as other versions that it finds in the local PATH or downloads as needed. [...] When GOTOOLCHAIN is set to local, the go command always runs the bundled Go toolchain. [...] When using GOTOOLCHAIN=auto or GOTOOLCHAIN=+auto, the Go command downloads newer toolchains as needed. These toolchains are packaged as special modules with module path golang.org/toolchain and version v0.0.1-goVERSION.GOOS-GOARCH. Toolchains are downloaded like any other module, meaning that toolchain downloads can be proxied by setting GOPROXY and have their checksums checked by the Go checksum database. Because the specific toolchain used depends on the system’s own default toolchain as well as the local operating system and architecture (GOOS and GOARCH), it is not practical to write toolchain module checksums to go.sum. Instead, toolchain downloads fail for lack of verification if GOSUMDB=off. GOPRIVATE and GONOSUMDB patterns do not apply to the toolchain downloads." I think we should leave this set to "auto" for the following reasons: - The toolchain is now considered part of a module's dependencies, and it will be downloaded just like any other dependency. - This seems to be a major stance the Go project is taking on how things work, and if our package doesn't perform these automatic downloads it will be surprising/confusing for Go developers. - Automatic downloads do not pollute the user's path nor do they attempt to pollute the store. - When our packages are built with > 1.21.0, we'll still have reproducible builds because any modules requiring a greater versioned toolchain will fail to download it due to our isolated build container and thus the build will fail and the packager will still have to reference the correct version of Go. More details here: https://go.dev/blog/toolchain > + > + (symlink "lib/go/bin" (string-append out "/bin")) > + > + (for-each > + (match-lambda > + ((file dest output) > + ;; Copy to output/dest and symlink from output/lib/go/file. > + (let ((file* (string-append output "/lib/go/" file)) > + (dest* (string-append output "/" dest))) > + (copy-recursively file dest*) > + (mkdir-p (dirname file*)) > + (symlink (string-append "../../" dest) file*)))) > + `(("src" "share/go/src" ,out) > + ("misc" "share/go/misc" ,out) > + ("doc" "share/doc/go/doc" ,out) > + ("api" "share/go/api" ,tests) > + ("test" "share/go/test" ,tests)))))))))))) > + > (define-public go go-1.17) > > (define make-go-std > > base-commit: a4bed14c438dc0cbc1c1885a38f8409c7fef7957