siderolabs / conform

Policy enforcement for your pipelines.
Mozilla Public License 2.0
432 stars 45 forks source link

fix: Correctly return errors from command run function #155

Closed wdullaer closed 4 years ago

wdullaer commented 4 years ago

Cobra will print a stacktrace if you forcibly close the process from within a cmd.Run function. Using RunE and returning errors will prevent this.

Cobra will print errors returned this way for you, so the fmt.Println(err) in rootCmd was redundant.

You may also want to do this in the serve command, but I did not touch it right now.

andrewrynhard commented 4 years ago

Thanks @wdullaer. 👍 LGTM.