[PATCH 23/25] gnu: Add gofumpt.

  • Done
  • quality assurance status badge
Details
3 participants
  • Katherine Cox-Buday
  • Tobias Geerinckx-Rice
  • (
Owner
unassigned
Submitted by
Katherine Cox-Buday
Severity
normal
Merged with
K
K
Katherine Cox-Buday wrote on 18 Jan 2023 02:45
(address . guix-patches@gnu.org)(name . Katherine Cox-Buday)(address . cox.katherine.e@gmail.com)
20230118014510.19320-24-cox.katherine.e@gmail.com
* gnu/packages/golang.scm (gofumpt): New variable.
---
gnu/packages/golang.scm | 68 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)

Toggle diff (81 lines)
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
T
T
Tobias Geerinckx-Rice wrote on 18 Jan 2023 12:43
(no subject)
(address . control@debbugs.gnu.org)
37de5823441633151229c783f2acfca3@tobias.gr
merge 60898 60921 60922
thanks

Weird: I got ‘Unknown command or malformed arguments to command.’ for
this obviously correct line.

Let's try again.
K
K
Katherine Cox-Buday wrote on 18 Jan 2023 18:07
Merging erroneously opened bugs
(address . control@debbugs.gnu.org)
87zgafrct9.fsf@gmail.com
merge 60899 60904 60907 60908 60917 60920 60921 60919 60910 60903 60915 60914 60922 60909 60918 60913 60900 60899 60905 60901 60912 60898 60906 60902 60916 60911
--
Katherine
(
Re: [bug#60922] [PATCH 23/25] gnu: Add gofumpt.
CQBV3EDZNHUP.36S3EE4IC33VC@guix-framework
* gnu/packages/golang.scm (gofumpt): New variable.

Toggle quote (10 lines)
> --- 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.")

-- (
-----BEGIN PGP SIGNATURE-----

iQGzBAABCgAdFiEE6Vh10NblKE5doNlW7ImHg/nqI20FAmPhioYACgkQ7ImHg/nq
I22lTQv/fA2L8U0V7VhmSoBJRPwwTXzS+lnflczrvP8Gk3g25XWXl0JddtiXVlUp
At3Yhw/52BlemsPElcNykmoAPRLY9Ox5a4T1o577YRKR47ihk/dRXLZkQzSEK4gl
wFu1TafpS28OnuMri0uKtlmFKR4hBwHP7lVJu53m8qXRfG5To0k2kEatiZ8g57pb
Jfh8qajAXunspk1+NhUyJw82BMcUkBB1rFTDFVoPhv5hpeppQpgXTGQWoGn8FJyw
hLPRgZ95N7kFL/jTU+m6Ar6EnZII/tOIuC+csI8uMr2t2sT83qtyJdnQaaLzHGRb
lP9bo8jl674EPXO76sscQfRq8tIBeVko8TXNHOHiZIYSalZ1RrKS/qhKXhwbQuGD
JzmHJ0kyHrCw7Y+JBUE3LbQrYYPFOhOnr+yM6GFTybo28jWd62iCmGDNsM+r2Vjg
Uw3xMggQgR6I5FKGXdv6HA1wvtJMwxjzshQF8FeXM97MkVZoVAn3WMsW/JpWI/+N
/LpUWGAD
=cq8F
-----END PGP SIGNATURE-----


?