From d547bd9f83a10e1834e42d6d59c40c1db96bb4e9 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Thu, 23 Jul 2020 11:48:48 -0700 Subject: [PATCH] use xerrors.As --- cli/helper.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cli/helper.go b/cli/helper.go index 5626488e0..536301e87 100644 --- a/cli/helper.go +++ b/cli/helper.go @@ -5,6 +5,7 @@ import ( "os" "github.com/urfave/cli/v2" + "golang.org/x/xerrors" ) type PrintHelpErr struct { @@ -36,8 +37,8 @@ func RunApp(app *cli.App) { } else { fmt.Printf("ERROR: %s\n\n", err) } - phe, ok := err.(*PrintHelpErr) - if ok { + var phe *PrintHelpErr + if xerrors.As(err, &phe) { cli.ShowCommandHelp(phe.Ctx, phe.Ctx.Command.Name) } os.Exit(1)