From 68c21faf64c9b4de64be45bf91b04791904b0700 Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Fri, 30 Apr 2021 09:55:39 +0200 Subject: [PATCH] Check persistnt flag errors --- cmd/headscale/headscale.go | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/cmd/headscale/headscale.go b/cmd/headscale/headscale.go index fd90664b..3ea3a00a 100644 --- a/cmd/headscale/headscale.go +++ b/cmd/headscale/headscale.go @@ -92,16 +92,28 @@ func main() { headscaleCmd.AddCommand(versionCmd) cli.NodeCmd.PersistentFlags().StringP("namespace", "n", "", "Namespace") - cli.NodeCmd.MarkPersistentFlagRequired("namespace") + err = cli.NodeCmd.MarkPersistentFlagRequired("namespace") + if err != nil { + log.Fatalf(err.Error()) + } cli.PreauthkeysCmd.PersistentFlags().StringP("namespace", "n", "", "Namespace") - cli.PreauthkeysCmd.MarkPersistentFlagRequired("namespace") + err = cli.PreauthkeysCmd.MarkPersistentFlagRequired("namespace") + if err != nil { + log.Fatalf(err.Error()) + } cli.RegisterCmd.PersistentFlags().StringP("namespace", "n", "", "Namespace") - cli.RegisterCmd.MarkPersistentFlagRequired("namespace") + err = cli.RegisterCmd.MarkPersistentFlagRequired("namespace") + if err != nil { + log.Fatalf(err.Error()) + } cli.RoutesCmd.PersistentFlags().StringP("namespace", "n", "", "Namespace") - cli.RoutesCmd.MarkPersistentFlagRequired("namespace") + err = cli.RoutesCmd.MarkPersistentFlagRequired("namespace") + if err != nil { + log.Fatalf(err.Error()) + } cli.NamespaceCmd.AddCommand(cli.CreateNamespaceCmd) cli.NamespaceCmd.AddCommand(cli.ListNamespacesCmd)