Skip to content

Commit

Permalink
Fix double reporting of some CLI errors (#1301)
Browse files Browse the repository at this point in the history
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
  • Loading branch information
kke committed Dec 2, 2021
1 parent 2a62985 commit b4431f9
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,7 @@ func (c *cliOpts) buildConfig() error {
}

func Execute() {
// just a hack to trick linter which requires to check for errors
// cobra itself already prints out all errors that happen in subcommands
err := NewRootCmd().Execute()
if err != nil {
log.Fatal(err)
if err := NewRootCmd().Execute(); err != nil {
os.Exit(1)
}
}

0 comments on commit b4431f9

Please sign in to comment.