[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
23/25: gnu: Add gofumpt.
From: |
guix-commits |
Subject: |
23/25: gnu: Add gofumpt. |
Date: |
Mon, 6 Feb 2023 18:06:21 -0500 (EST) |
cbaines pushed a commit to branch master
in repository guix.
commit 15330b625ae928d6b94b5dc4515fa65e7e192cc1
Author: Katherine Cox-Buday <cox.katherine.e@gmail.com>
AuthorDate: Tue Jan 17 18:45:08 2023 -0700
gnu: Add gofumpt.
* gnu/packages/golang.scm (gofumpt): New variable.
Signed-off-by: Christopher Baines <mail@cbaines.net>
---
gnu/packages/golang.scm | 68 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 026ee25be1..2b16eb786f 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -9912,6 +9912,74 @@ atomic access.")
"@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")
- 12/25: gnu: Add xurls., (continued)
- 12/25: gnu: Add xurls., guix-commits, 2023/02/06
- 02/25: gnu: go-golang-org-x-mod: Update to 0.7.0., guix-commits, 2023/02/06
- 11/25: gnu: go-golang-org-x-tools: Update to 0.5.0., guix-commits, 2023/02/06
- 14/25: gnu: Add misspell., guix-commits, 2023/02/06
- 06/25: gnu: Add go-github-com-jba-templatecheck., guix-commits, 2023/02/06
- 13/25: gnu: Add go-mvdan-cc-xurls., guix-commits, 2023/02/06
- 03/25: gnu: Add go-golang-org-x-exp., guix-commits, 2023/02/06
- 10/25: gnu: gopkg-in-errgo-fmt-errors: Rename to go-gopkg-in-errgo-fmt-errors., guix-commits, 2023/02/06
- 08/25: gnu: go-github-com-pkg-diff: Update to 0.0.0-20210226163009-20ebb0f2a09e., guix-commits, 2023/02/06
- 15/25: gnu: Add go-github-com-client9-misspell., guix-commits, 2023/02/06
- 23/25: gnu: Add gofumpt.,
guix-commits <=
- 24/25: gnu: Add go-mvdan-cc-gofumpt., guix-commits, 2023/02/06
- 09/25: gnu: go-github-com-rogpeppe-go-internal: Update to 1.9.0., guix-commits, 2023/02/06
- 16/25: gnu: Add go-github-com-google-go-cmdtest., guix-commits, 2023/02/06
- 20/25: gnu: Add go-golang-org-x-vuln., guix-commits, 2023/02/06
- 22/25: gnu: go-honnef-co-go-tools: Update to 0.3.3., guix-commits, 2023/02/06
- 17/25: gnu: Add unparam., guix-commits, 2023/02/06
- 01/25: gnu: go-golang-org-x-sync: Update to 0.1.0-1.8fcdb60., guix-commits, 2023/02/06
- 18/25: gnu: Add go-mvdan-cc-unparam., guix-commits, 2023/02/06
- 19/25: gnu: Add govulncheck., guix-commits, 2023/02/06
- 25/25: gnu: Add gopls., guix-commits, 2023/02/06