update comment and explain why we use cmdutil.CheckErr

Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
This commit is contained in:
Tim Ramlot 2023-08-01 16:17:06 +02:00
parent 78b78cecca
commit e3d6717387
No known key found for this signature in database
GPG Key ID: 47428728E0C2878D

View File

@ -37,7 +37,8 @@ func main() {
logf.InitLogs()
defer logf.FlushLogs()
// In cmctl, we are using cmdutil.CheckErr, which will call os.Exit(1) if it receives an error.
// In cmctl, we are using cmdutil.CheckErr, a kubectl utility function that creates human readable
// error messages from errors. By default, this function will call os.Exit(1) if it receives an error.
// Instead, we want to do a soft exit, and use SetExitCode to set the correct exit code.
// Additionally, we make sure to output the final error message to stdout, as we do not want this
// message to be mixed with other log outputs from the execution of the command.