From 3b5ada1fd835ef128f0b1e0fe315a83f1cf63418 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 27 Oct 2021 14:06:22 -0700 Subject: [PATCH] cmd/tailscale/cli: use errors.Is to check ff's wrapped flag errors And also check from its Parse method. Change-Id: I18754920575254cb6858a16b7954e74aa16483a1 Signed-off-by: Brad Fitzpatrick --- cmd/tailscale/cli/cli.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/tailscale/cli/cli.go b/cmd/tailscale/cli/cli.go index 37da5bc2d..369995aeb 100644 --- a/cmd/tailscale/cli/cli.go +++ b/cmd/tailscale/cli/cli.go @@ -139,13 +139,16 @@ func Run(args []string) error { } if err := rootCmd.Parse(args); err != nil { + if errors.Is(err, flag.ErrHelp) { + return nil + } return err } tailscale.TailscaledSocket = rootArgs.socket err := rootCmd.Run(context.Background()) - if err == flag.ErrHelp { + if errors.Is(err, flag.ErrHelp) { return nil } return err