gnu: go-honnef-co-go-tools: Fix build for inherited packages.

Fixes guix/guix#1555

Simplify package by utilizing <skip-build?> argument parameter and using
default 'check. Do not overwrite chosen go compiler in inherited
packages which fixes their build.

* gnu/packages/golang-check.scm (go-honnef-co-go-tools):
  [arguments] <skip-build?>: No go files in project's root, use it
  instead of deleting 'build phase.
  <phases>: Use default 'check.

(go-staticcheck, go-structlayout, go-structlayout,optimize,
go-structlayout-pretty): Do not overwrite argument paramter, substitue
them. Swap INHERIT with PACKAGE/INHERIT.

Change-Id: I308e6162813757a1c668bb328652adf89b3b30f0
This commit is contained in:
Sharlatan Hellseher 2025-07-24 23:51:10 +01:00
parent 6566207b0f
commit 90880a7d65
No known key found for this signature in database
GPG key ID: 76D727BFF62CD2B5

View file

@ -2826,16 +2826,9 @@ used to skip the test
(arguments (arguments
(list (list
#:go go-1.23 #:go go-1.23
#:skip-build? #t
#:import-path "honnef.co/go/tools" #:import-path "honnef.co/go/tools"
#:phases #:unpack-path "honnef.co/go/tools"))
#~(modify-phases %standard-phases
;; XXX: Workaround for go-build-system's lack of Go modules support.
(delete 'build)
(replace 'check
(lambda* (#:key tests? import-path #:allow-other-keys)
(when tests?
(with-directory-excursion (string-append "src/" import-path)
(invoke "go" "test" "-v" "./..."))))))))
(propagated-inputs (propagated-inputs
(list go-github-com-burntsushi-toml (list go-github-com-burntsushi-toml
go-golang-org-x-exp go-golang-org-x-exp
@ -3017,13 +3010,18 @@ without needing to use a tool like Wireshark.")))
tool.")))) tool."))))
(define-public go-staticcheck (define-public go-staticcheck
(package (package/inherit go-honnef-co-go-tools
(inherit go-honnef-co-go-tools)
(name "go-staticcheck") (name "go-staticcheck")
(arguments (arguments
`(#:import-path "honnef.co/go/tools/cmd/staticcheck" (substitute-keyword-arguments
#:unpack-path "honnef.co/go/tools" (package-arguments go-honnef-co-go-tools)
#:install-source? #f)) ((#:tests? _ #t) #f)
((#:skip-build? _ #t) #f)
((#:install-source? _ #t) #f)
((#:import-path _) "honnef.co/go/tools/cmd/staticcheck")))
(native-inputs (package-propagated-inputs go-honnef-co-go-tools))
(propagated-inputs '())
(inputs '())
(synopsis "Staticcheck advanced Go linter") (synopsis "Staticcheck advanced Go linter")
(description (description
"Staticcheck is a state of the art linter for the Go programming language. "Staticcheck is a state of the art linter for the Go programming language.
@ -3031,13 +3029,18 @@ Using static analysis, it finds bugs and performance issues, offers
simplifications, and enforces style rules."))) simplifications, and enforces style rules.")))
(define-public go-structlayout (define-public go-structlayout
(package (package/inherit go-honnef-co-go-tools
(inherit go-honnef-co-go-tools)
(name "go-structlayout") (name "go-structlayout")
(arguments (arguments
`(#:import-path "honnef.co/go/tools/cmd/structlayout" (substitute-keyword-arguments
#:unpack-path "honnef.co/go/tools" (package-arguments go-honnef-co-go-tools)
#:install-source? #f)) ((#:tests? _ #t) #f)
((#:skip-build? _ #t) #f)
((#:install-source? _ #t) #f)
((#:import-path _) "honnef.co/go/tools/cmd/structlayout")))
(native-inputs (package-propagated-inputs go-honnef-co-go-tools))
(propagated-inputs '())
(inputs '())
(synopsis "Display the layout (field sizes and padding) of structs in Go") (synopsis "Display the layout (field sizes and padding) of structs in Go")
(description "This package prints the layout of a struct in Go, which is (description "This package prints the layout of a struct in Go, which is
the byte offset and size of each field, respecting padding. This information the byte offset and size of each field, respecting padding. This information
@ -3045,26 +3048,36 @@ is printed in human-readable form by default, or as JSON with the @code{-json}
flag."))) flag.")))
(define-public go-structlayout-optimize (define-public go-structlayout-optimize
(package (package/inherit go-honnef-co-go-tools
(inherit go-honnef-co-go-tools)
(name "go-structlayout-optimize") (name "go-structlayout-optimize")
(arguments (arguments
`(#:import-path "honnef.co/go/tools/cmd/structlayout-optimize" (substitute-keyword-arguments
#:unpack-path "honnef.co/go/tools" (package-arguments go-honnef-co-go-tools)
#:install-source? #f)) ((#:tests? _ #t) #f)
((#:skip-build? _ #t) #f)
((#:install-source? _ #t) #f)
((#:import-path _) "honnef.co/go/tools/cmd/structlayout-optimize")))
(native-inputs (package-propagated-inputs go-honnef-co-go-tools))
(propagated-inputs '())
(inputs '())
(synopsis "Reorder struct fields to minimize the amount of padding in Go") (synopsis "Reorder struct fields to minimize the amount of padding in Go")
(description "This package reads @code{go-structlayout} JSON on stdin and (description "This package reads @code{go-structlayout} JSON on stdin and
reorders fields to minimize the amount of padding. It can emit JSON to feed reorders fields to minimize the amount of padding. It can emit JSON to feed
into @code{go-structlayout-pretty}."))) into @code{go-structlayout-pretty}.")))
(define-public go-structlayout-pretty (define-public go-structlayout-pretty
(package (package/inherit go-honnef-co-go-tools
(inherit go-honnef-co-go-tools)
(name "go-structlayout-pretty") (name "go-structlayout-pretty")
(arguments (arguments
`(#:import-path "honnef.co/go/tools/cmd/structlayout-pretty" (substitute-keyword-arguments
#:unpack-path "honnef.co/go/tools" (package-arguments go-honnef-co-go-tools)
#:install-source? #f)) ((#:tests? _ #t) #f)
((#:skip-build? _ #t) #f)
((#:install-source? _ #t) #f)
((#:import-path _) "honnef.co/go/tools/cmd/structlayout-pretty")))
(native-inputs (package-propagated-inputs go-honnef-co-go-tools))
(propagated-inputs '())
(inputs '())
(synopsis "Format the output of go-structlayout with ASCII art in Go") (synopsis "Format the output of go-structlayout with ASCII art in Go")
(description "This package takes @code{go-structlayout}-like JSON and (description "This package takes @code{go-structlayout}-like JSON and
prints an ASCII fraphic representing the memory layout."))) prints an ASCII fraphic representing the memory layout.")))