guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

04/04: gnu: go-github-com-urfave-cli-v2: Fix tests when building with Go


From: guix-commits
Subject: 04/04: gnu: go-github-com-urfave-cli-v2: Fix tests when building with Go 1.17.
Date: Thu, 9 Sep 2021 21:35:56 -0400 (EDT)

lfam pushed a commit to branch master
in repository guix.

commit 63cc4dd5793b62802354a31d8e6913f065d3bcec
Author: Sarah Morgensen <iskarian@mgsn.dev>
AuthorDate: Thu Sep 9 17:50:10 2021 -0700

    gnu: go-github-com-urfave-cli-v2: Fix tests when building with Go 1.17.
    
    * gnu/packages/patches/go-github-com-urfave-cli-v2-fix-tests.patch: New 
file.
    * gnu/local.mk (dist_patch_DATA): Register it.
    * gnu/packages/golang.scm (go-github-com-urfave-cli-v2)[origin]: Apply it.
    
    Signed-off-by: Leo Famulari <leo@famulari.name>
---
 gnu/local.mk                                       |  1 +
 gnu/packages/golang.scm                            |  5 ++-
 .../go-github-com-urfave-cli-v2-fix-tests.patch    | 37 ++++++++++++++++++++++
 3 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 3148c9e..175e691 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1185,6 +1185,7 @@ dist_patch_DATA =                                         
\
   %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-github-com-urfave-cli-v2-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           \
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 2d0bbdb..4c6b41e 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -5003,7 +5003,10 @@ fast and distributable command line applications in an 
expressive way.")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "08pvn7gyfznni72xrxfh2x6xxa8ykr7l1ka278js8g8qkh71bj8l"))))
+        (base32 "08pvn7gyfznni72xrxfh2x6xxa8ykr7l1ka278js8g8qkh71bj8l"))
+       ;; XXX: Remove patch when updating.
+       (patches
+        (search-patches "go-github-com-urfave-cli-v2-fix-tests.patch"))))
     (arguments
      '(#:import-path "github.com/urfave/cli/v2"))))
 
diff --git a/gnu/packages/patches/go-github-com-urfave-cli-v2-fix-tests.patch 
b/gnu/packages/patches/go-github-com-urfave-cli-v2-fix-tests.patch
new file mode 100644
index 0000000..87ccc2b
--- /dev/null
+++ b/gnu/packages/patches/go-github-com-urfave-cli-v2-fix-tests.patch
@@ -0,0 +1,37 @@
+From upstream PR: https://github.com/urfave/cli/pull/1299
+
+From: William Wilson <william.wilson@canonical.com>
+Date: Tue, 31 Aug 2021 14:19:17 -0500
+Subject: Make test case compatible with Go 1.17
+
+As of Go 1.17, the go flag package will panic if given a syntactically invalid
+flag. This causes TestApp_RunAsSubCommandIncorrectUsage to panic and therefore
+fail. See https://golang.org/doc/go1.17#flag for more information.
+
+---
+diff --git a/app_test.go b/app_test.go
+index 7c38f6048..76e211d68 100644
+--- a/app_test.go
++++ b/app_test.go
+@@ -476,18 +476,18 @@ func TestApp_RunAsSubCommandIncorrectUsage(t *testing.T) 
{
+       a := App{
+               Name: "cmd",
+               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) {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]