GNU bug report logs - #60922
[PATCH 23/25] gnu: Add gofumpt.

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>; Keywords: patch; merged with #60898, #60899, #60900, #60901, #60902, #60903, #60904, #60905, #60906, #60907, #60908, #60909, #60910, #60911, #60912, #60913, #60914, #60915, #60916, #60917, #60918, #60919, #60920, #60921; dated Wed, 18 Jan 2023 01:46:18 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.
Merged 60898 60899 60900 60901 60902 60903 60904 60905 60906 60907 60908 60909 60910 60911 60912 60913 60914 60915 60916 60917 60918 60919 60920 60921 60922. Request was from Katherine Cox-Buday <cox.katherine.e@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Merged 60898 60899 60900 60901 60902 60903 60904 60905 60906 60907 60908 60909 60910 60911 60912 60913 60914 60915 60916 60917 60918 60919 60920 60921 60922. Request was from Tobias Geerinckx-Rice <me@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 18 Jan 2023 01:45:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 17 20:45:59 2023
Received: from localhost ([127.0.0.1]:38653 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pHxWY-0007YL-ON
	for submit <at> debbugs.gnu.org; Tue, 17 Jan 2023 20:45:59 -0500
Received: from lists.gnu.org ([209.51.188.17]:44550)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <cox.katherine.e@HIDDEN>) id 1pHxW8-0007Vp-Ca
 for submit <at> debbugs.gnu.org; Tue, 17 Jan 2023 20:45:33 -0500
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 <cox.katherine.e@HIDDEN>)
 id 1pHxW8-0002CH-2S
 for guix-patches@HIDDEN; Tue, 17 Jan 2023 20:45:32 -0500
Received: from mail-il1-x12d.google.com ([2607:f8b0:4864:20::12d])
 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 1pHxW6-00076T-AK
 for guix-patches@HIDDEN; Tue, 17 Jan 2023 20:45:31 -0500
Received: by mail-il1-x12d.google.com with SMTP id v6so6853486ilq.3
 for <guix-patches@HIDDEN>; Tue, 17 Jan 2023 17:45:29 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=N5XoULSc/RpQ9HrHY5fnRm6QXy+f1wK2MKhKB2z42Ho=;
 b=XXzq2gkW6Ngm5I0BRVsz8XkzL7UWsrIOMJDfPx2lnnFRr4GBCYRFSX/5w8GzCU4lsJ
 mxnkFW7yIJN7IZxMeAsAlojFRHr0gIFy1mY/oCRmgdVtO/PXIlpTNFHO9Fd5sajvs43m
 R+h7svcz5SNp8WPx184WIrXDnqfhzrurYQystXGD3UVL1pdQHOESEimR6AQ439K8YXF+
 83MvGw/fk71bVz/wETc+815rmtwKxwIN09F2kZkXtrKUGi4nZNJN5FSsy7h1tu4K95D3
 SwG6yqaGqVLPGI0Y+Ff/QDolg3gVgvbfrtfoO+MUKBKYRWube3aoarlGjafiZVTJX0WO
 mOHA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=N5XoULSc/RpQ9HrHY5fnRm6QXy+f1wK2MKhKB2z42Ho=;
 b=xkMpbsP7mMpmdKuS5sz2dWfqNZqIdkHwX7lGUdGywlaMT2Ev7CZp+f199C4HRhJTnp
 tKlAv/1yHrkpJL+yG3ABTuk7Wj8pVNnWcO676JdqTs9AqTNLwQxF5Uaxvy7kkfsKKfxp
 C2bDDcXtmhQXpTEgMswFoTgrcIypgA9wIJp5eg0nMrlsTH8EZ0gILI4ppVB1SbhNrSZw
 8NY2Z196m4Y2hl7FuGpOLUkDo4SJH/NBXl51iyf5qqusTysQqOwKKtD9Q14DgdQgv4Gn
 mjGkEaqmNp1Qlnz/k7XpN8NDKH5gjlpEo3LvOyB3Ykeq8XaNZCV4w2oQ9fmGGNT3DhmZ
 7khw==
X-Gm-Message-State: AFqh2krtnCcwBnCNhnhHIZ8Lqk6qx6fBFgOTqUuoDZX2sBPJ4VjzfcUb
 bLvP9nR5C1aSQNd8zvQp03+ZB2XksvQ=
X-Google-Smtp-Source: AMrXdXs2M4NPoDHvmWQuKFmaUQvTlfitkHoYFhrvxlfUzFnZj0ByORsP444/44X0nbdOXo0/JDpYzA==
X-Received: by 2002:a92:d284:0:b0:30e:f15d:4bed with SMTP id
 p4-20020a92d284000000b0030ef15d4bedmr4232542ilp.30.1674006329074; 
 Tue, 17 Jan 2023 17:45:29 -0800 (PST)
Received: from washu-v4.home.cox-buday.com
 (c-174-51-139-101.hsd1.co.comcast.net. [174.51.139.101])
 by smtp.gmail.com with ESMTPSA id
 p32-20020a056638192000b0039e89ea68f9sm7889250jal.135.2023.01.17.17.45.28
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 17 Jan 2023 17:45:28 -0800 (PST)
From: Katherine Cox-Buday <cox.katherine.e@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH 23/25] gnu: Add gofumpt.
Date: Tue, 17 Jan 2023 18:45:08 -0700
Message-Id: <20230118014510.19320-24-cox.katherine.e@HIDDEN>
X-Mailer: git-send-email 2.38.1
In-Reply-To: <20230118014510.19320-1-cox.katherine.e@HIDDEN>
References: <20230118014510.19320-1-cox.katherine.e@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=2607:f8b0:4864:20::12d;
 envelope-from=cox.katherine.e@HIDDEN; helo=mail-il1-x12d.google.com
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: -1.3 (-)
X-Debbugs-Envelope-To: submit
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: -2.3 (--)

* gnu/packages/golang.scm (gofumpt): New variable.
---
 gnu/packages/golang.scm | 68 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 97f1753f42..40b6cf4a62 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -9868,6 +9868,74 @@ (define-public go-go-uber-org-multierr
      "@code{multierr} allows combining one or more Go errors together.")
     (license license:expat)))
 
+(define-public gofumpt
+  (package
+    (name "gofumpt")
+    (version "0.4.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/mvdan/gofumpt")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "13ahi8q1a9h4dj6a7xp95c79d5svz5p37b6z91aswbq043qd417k"))
+              (modules '((guix build utils)))
+              (snippet `(let ((fixed-version (string-append ,version
+                                                            " (GNU Guix)")))
+                          ;; Gofumpt formats Go files, and therefore modifies
+                          ;; them. To help the developers diagnose issues, it
+                          ;; replaces any occurrence of a `//gofumpt:diagnose`
+                          ;; comment with some debugging information which
+                          ;; includes the module version. In the event gofumpt
+                          ;; was built without module support, it falls back
+                          ;; to a string "(devel)". Since our build system
+                          ;; does not yet support modules, we'll inject our
+                          ;; version string instead, since this is more
+                          ;; helpful.
+                          (substitute* "internal/version/version.go"
+                            (("^const fallbackVersion.+")
+                             (format #f "const fallbackVersion = \"~a\"~%"
+                                     fixed-version)))
+                          ;; These tests rely on `//gofumpt:diagnose` comments
+                          ;; being replaced with fixed information injected
+                          ;; from the test scripts, but this requires a binary
+                          ;; compiled as a Go module. Since we can't do this
+                          ;; yet, modify the test scripts with the version
+                          ;; string we're injecting.
+                          (delete-file "testdata/script/diagnose.txtar")
+                          (substitute* (find-files "testdata/script/"
+                                                   "\\.txtar$")
+                            (("v0.0.0-20220727155840-8dda8068d9f3")
+                             fixed-version)
+                            (("(devel)")
+                             fixed-version)
+                            (("v0.3.2-0.20220627183521-8dda8068d9f3")
+                             fixed-version))))))
+    (build-system go-build-system)
+    (arguments
+     `(#:import-path "mvdan.cc/gofumpt"
+       #:go ,go-1.19))
+    (native-inputs (list go-gopkg-in-errgo-fmt-errors))
+    (propagated-inputs (list go-github-com-pkg-diff
+                             go-github-com-kr-text
+                             go-github-com-kr-pretty
+                             go-golang-org-x-tools
+                             go-golang-org-x-sys
+                             go-golang-org-x-sync
+                             go-golang-org-x-mod
+                             go-github-com-rogpeppe-go-internal
+                             go-github-com-google-go-cmp-cmp
+                             go-github-com-frankban-quicktest))
+    (home-page "https://mvdan.cc/gofumpt/")
+    (synopsis "Formats Go files with a stricter ruleset than gofmt")
+    (description
+     "Enforce a stricter format than @@code{gofmt}, while being backwards compatible.
+That is, @@code{gofumpt} is happy with a subset of the formats that
+@@code{gofmt} is happy with.")
+    (license license:bsd-3)))
+
 (define-public unparam
   (package
     (name "unparam")
-- 
2.38.1





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#60922; 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: Wed, 18 Jan 2023 17:15:02 UTC

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