Skip to content

Commit

Permalink
hotfix: fix double error message prints (#317)
Browse files Browse the repository at this point in the history
This incorrect change was introduced in 598f214.
  • Loading branch information
hbagdi committed Apr 8, 2021
1 parent 0da2b07 commit 1b00518
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 6 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@ It can be used to export, import or sync entities to Kong.`,
// Execute adds all child commands to the root command and sets
// sflags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() error {
return rootCmd.Execute()
func Execute() {
err := rootCmd.Execute()
if err != nil {
// do not print error because cobra already prints it
os.Exit(1)
}
}

//nolint:errcheck
Expand Down
6 changes: 1 addition & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ func registerSignalHandler() {

func main() {
registerSignalHandler()
err := cmd.Execute()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
cmd.Execute()
}

func init() {
Expand Down

0 comments on commit 1b00518

Please sign in to comment.