gnu: go-github-com-urfave-cli: Fix tests when building with Go 1.17.

* gnu/packages/patches/go-github-com-urfave-cli-fix-tests.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/golang.scm (go-github-com-urfave-cli)[origin]: Apply it.

Signed-off-by: Leo Famulari <leo@famulari.name>
This commit is contained in:
Sarah Morgensen 2021-09-09 17:50:09 -07:00 committed by Leo Famulari
parent 4e1adbc3b0
commit f161f111e0
No known key found for this signature in database
GPG key ID: 2646FA30BACA7F08
3 changed files with 31 additions and 1 deletions

View file

@ -1184,6 +1184,7 @@ dist_patch_DATA = \
%D%/packages/patches/gobject-introspection-cc.patch \
%D%/packages/patches/gobject-introspection-girepository.patch \
%D%/packages/patches/go-fix-script-tests.patch \
%D%/packages/patches/go-github-com-urfave-cli-fix-tests.patch \
%D%/packages/patches/go-skip-gc-test.patch \
%D%/packages/patches/gpm-glibc-2.26.patch \
%D%/packages/patches/gpodder-disable-updater.patch \

View file

@ -4976,7 +4976,8 @@ (define-public go-github-com-urfave-cli
(file-name (git-file-name name version))
(sha256
(base32
"10mcnvi5qmn00vpyk6si8gjka7p654wr9hac4zc9w5h3ickhvbdc"))))
"10mcnvi5qmn00vpyk6si8gjka7p654wr9hac4zc9w5h3ickhvbdc"))
(patches (search-patches "go-github-com-urfave-cli-fix-tests.patch"))))
(build-system go-build-system)
(arguments
'(#:import-path "github.com/urfave/cli"))

View file

@ -0,0 +1,28 @@
Backported from upstream PR: https://github.com/urfave/cli/pull/1299
---
diff --git a/app_test.go b/app_test.go
index 33024ff..6b3aaa3 100644
--- a/app_test.go
+++ b/app_test.go
@@ -513,18 +513,18 @@ func TestApp_RunAsSubcommandParseFlags(t *testing.T) {
func TestApp_RunAsSubCommandIncorrectUsage(t *testing.T) {
a := App{
Flags: []Flag{
- StringFlag{Name: "--foo"},
+ StringFlag{Name: "foo"},
},
Writer: bytes.NewBufferString(""),
}
set := flag.NewFlagSet("", flag.ContinueOnError)
- _ = set.Parse([]string{"", "---foo"})
+ _ = set.Parse([]string{"", "-bar"})
c := &Context{flagSet: set}
err := a.RunAsSubcommand(c)
- expect(t, err, errors.New("bad flag syntax: ---foo"))
+ expect(t, err.Error(), "flag provided but not defined: -bar")
}
func TestApp_CommandWithFlagBeforeTerminator(t *testing.T) {