From 1beb476da9b46aef65cc176d683f4278cb944085 Mon Sep 17 00:00:00 2001 From: ANGkeith Date: Wed, 8 Dec 2021 07:03:24 +0800 Subject: [PATCH] fix: Duplicate error message from cobra init boilerplates (#1463) --- cobra/tpl/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cobra/tpl/main.go b/cobra/tpl/main.go index d2f7742..8e2fe4e 100644 --- a/cobra/tpl/main.go +++ b/cobra/tpl/main.go @@ -67,7 +67,10 @@ to quickly create a Cobra application.` + "`" + `, // Execute adds all child commands to the root command and sets flags appropriately. // This is called by main.main(). It only needs to happen once to the rootCmd. func Execute() { - cobra.CheckErr(rootCmd.Execute()) + err := rootCmd.Execute() + if err != nil { + os.Exit(1) + } } func init() {