From 82992eb063f70d936af6e048f11667c9119b10ba Mon Sep 17 00:00:00 2001 From: ANGkeith Date: Sun, 25 Jul 2021 22:47:37 +0800 Subject: [PATCH] fix: Duplicate error message from cobra init boilerplates --- 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 ed3a98e14..81a72aeeb 100644 --- a/cobra/tpl/main.go +++ b/cobra/tpl/main.go @@ -52,7 +52,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() {