From e22a0c9315ac1ee00d07c63bcf2f4e8f94ca0001 Mon Sep 17 00:00:00 2001 From: Steve Francia Date: Fri, 20 Nov 2015 17:37:20 -0500 Subject: [PATCH] Better instructions for the execute inside main() --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 09dfb6f..caeebb9 100644 --- a/README.md +++ b/README.md @@ -156,7 +156,10 @@ package main import "{pathToYourApp}/cmd" func main() { - RootCmd.Execute() + if err := cmd.RootCmd.Execute(); err != nil { + fmt.Println(err) + os.Exit(-1) + } } ``` @@ -289,7 +292,10 @@ package main import "{pathToYourApp}/cmd" func main() { - RootCmd.Execute() + if err := cmd.RootCmd.Execute(); err != nil { + fmt.Println(err) + os.Exit(-1) + } } ```