mirror of
https://https.git.savannah.gnu.org/git/guix.git/
synced 2025-07-17 12:30:38 +02:00
gnu: gofumpt: Update to 0.7.0.
* gnu/packages/golang.scm (gofumpt): Update to 0.7.0. [source] <snippet>: Remove it and re-implement the logic in the 'set-fallback-version phase, #:build-flags and #:test-flags. [arguments] <go>: Use go-1.22. <build-flags>: Provide version. <test-flags>: Skip one test. <phases>: Add 'set-fallback-version. [propagated-inputs]: Remove go-github-com-pkg-diff, go-github-com-kr-text, go-github-com-kr-pretty, and go-github-com-frankban-quicktest. [native-inputs]: Remove go-gopkg-in-errgo-v2; add go-github-com-go-quicktest-qt. Change-Id: Ibddb05925040fe1293dedb246617ed366fc4014d
This commit is contained in:
parent
82ffd10e3e
commit
391ea54188
1 changed files with 33 additions and 45 deletions
|
@ -2701,7 +2701,7 @@ or capture raw audio.")
|
||||||
(define-public gofumpt
|
(define-public gofumpt
|
||||||
(package
|
(package
|
||||||
(name "gofumpt")
|
(name "gofumpt")
|
||||||
(version "0.4.0")
|
(version "0.7.0")
|
||||||
(source (origin
|
(source (origin
|
||||||
(method git-fetch)
|
(method git-fetch)
|
||||||
(uri (git-reference
|
(uri (git-reference
|
||||||
|
@ -2710,53 +2710,41 @@ or capture raw audio.")
|
||||||
(file-name (git-file-name name version))
|
(file-name (git-file-name name version))
|
||||||
(sha256
|
(sha256
|
||||||
(base32
|
(base32
|
||||||
"13ahi8q1a9h4dj6a7xp95c79d5svz5p37b6z91aswbq043qd417k"))
|
"0sz58av4jg0q26y1s4pznnvrzp1gi8brz9zw8aa46pzdmjw394wq"))))
|
||||||
(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)
|
(build-system go-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
`(#:import-path "mvdan.cc/gofumpt"))
|
(list
|
||||||
(native-inputs (list go-gopkg-in-errgo-v2))
|
#:go go-1.22
|
||||||
(propagated-inputs (list go-github-com-pkg-diff
|
#:build-flags
|
||||||
go-github-com-kr-text
|
;; Gofumpt formats Go files, and therefore modifies them. To help the
|
||||||
go-github-com-kr-pretty
|
;; developers diagnose issues, it replaces any occurrence of a
|
||||||
go-golang-org-x-tools
|
;; `//gofumpt:diagnose` comment with some debugging information which
|
||||||
go-golang-org-x-sys
|
;; includes the module version.
|
||||||
go-golang-org-x-sync
|
#~(list (format #f "-ldflags=-X ~s"
|
||||||
go-golang-org-x-mod
|
(string-append "main.version=" #$version " (GNU Guix)")))
|
||||||
|
#:import-path "mvdan.cc/gofumpt"
|
||||||
|
#:test-flags #~(list "-skip" "TestScript/diagnose")
|
||||||
|
#:phases
|
||||||
|
#~(modify-phases %standard-phases
|
||||||
|
(add-after 'unpack 'set-fallback-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.
|
||||||
|
(lambda* (#:key import-path #:allow-other-keys)
|
||||||
|
(with-directory-excursion (string-append "src/" import-path)
|
||||||
|
(substitute* "internal/version/version.go"
|
||||||
|
(("^const fallbackVersion.+")
|
||||||
|
(format #f "const fallbackVersion = ~s~%"
|
||||||
|
(string-append #$version " (GNU Guix)"))))))))))
|
||||||
|
(native-inputs
|
||||||
|
(list go-github-com-go-quicktest-qt))
|
||||||
|
(propagated-inputs (list go-github-com-google-go-cmp
|
||||||
go-github-com-rogpeppe-go-internal
|
go-github-com-rogpeppe-go-internal
|
||||||
go-github-com-google-go-cmp
|
go-golang-org-x-mod
|
||||||
go-github-com-frankban-quicktest))
|
go-golang-org-x-sync
|
||||||
|
go-golang-org-x-sys
|
||||||
|
go-golang-org-x-tools))
|
||||||
(home-page "https://mvdan.cc/gofumpt/")
|
(home-page "https://mvdan.cc/gofumpt/")
|
||||||
(synopsis "Formats Go files with a stricter ruleset than gofmt")
|
(synopsis "Formats Go files with a stricter ruleset than gofmt")
|
||||||
(description
|
(description
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue