fix: Duplicate error message from cobra init boilerplates (#1463)

This commit is contained in:
ANGkeith 2021-12-08 07:03:24 +08:00 committed by GitHub
parent 6f84ef4875
commit 1beb476da9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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() {