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

Previous Next

Package: guix-patches;

Reported by: Katherine Cox-Buday <cox.katherine.e <at> gmail.com>

Date: Wed, 18 Jan 2023 01:46:18 UTC

Severity: normal

Tags: 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

Done: Christopher Baines <mail <at> cbaines.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60922 in the body.
You can then email your comments to 60922 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#60922; Package guix-patches. (Wed, 18 Jan 2023 01:46:18 GMT) Full text and rfc822 format available.

Acknowledgement sent to Katherine Cox-Buday <cox.katherine.e <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 18 Jan 2023 01:46:18 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Katherine Cox-Buday <cox.katherine.e <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Katherine Cox-Buday <cox.katherine.e <at> gmail.com>
Subject: [PATCH 23/25] gnu: Add gofumpt.
Date: Tue, 17 Jan 2023 18:45:08 -0700
* 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





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 <at> tobias.gr> to control <at> debbugs.gnu.org. (Wed, 18 Jan 2023 11:44:03 GMT) Full text and rfc822 format 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 Katherine Cox-Buday <cox.katherine.e <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 18 Jan 2023 17:08:03 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#60922; Package guix-patches. (Mon, 06 Feb 2023 23:18:02 GMT) Full text and rfc822 format available.

Message #12 received at 60922 <at> debbugs.gnu.org (full text, mbox):

From: "(" <paren <at> disroot.org>
To: "Katherine Cox-Buday" <cox.katherine.e <at> gmail.com>, <60922 <at> debbugs.gnu.org>
Subject: Re: [bug#60922] [PATCH 23/25] gnu: Add gofumpt.
Date: Mon, 06 Feb 2023 23:17:25 +0000
[Message part 1 (text/plain, inline)]
* gnu/packages/golang.scm (gofumpt): New variable.

> --- a/gnu/packages/golang.scm
> +++ b/gnu/packages/golang.scm

> @@ -9868,6 +9868,74 @@ (define-public go-go-uber-org-multierr

> +    (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.")

  (description
   "This package provides a formatter for Go code that enforces a stricter
  subset of @code{gofmt}'s formatting.")

    -- (
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 08 Mar 2023 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 43 days ago.

Previous Next


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