Skip to content

Replace panic with os.Exit(1) for cleaner CLI error handling.#2

Open
olgeni wants to merge 1 commit intoksred:mainfrom
olgeni:fix-panic-on-unknown-command
Open

Replace panic with os.Exit(1) for cleaner CLI error handling.#2
olgeni wants to merge 1 commit intoksred:mainfrom
olgeni:fix-panic-on-unknown-command

Conversation

@olgeni
Copy link

@olgeni olgeni commented Dec 1, 2025

Cobra already prints the error message for unknown commands, so panicking is redundant and produces an ugly stacktrace. Now the program exits gracefully with a non-zero exit code.

Same effect but less scary 😃

Cobra already prints the error message for unknown commands, so panicking
is redundant and produces an ugly stacktrace. Now the program exits
gracefully with a non-zero exit code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant