Skip to content
This repository was archived by the owner on Jun 23, 2026. It is now read-only.

fix: don't panic on unknown command with single arg - #5

Open
beengud wants to merge 1 commit into
observeinc:mainfrom
beengud:upstream/fix-panic-unknown-command
Open

fix: don't panic on unknown command with single arg#5
beengud wants to merge 1 commit into
observeinc:mainfrom
beengud:upstream/fix-panic-unknown-command

Conversation

@beengud

@beengud beengud commented Jun 2, 2026

Copy link
Copy Markdown

Problem

When observe is invoked with a single unknown argument (e.g. observe foobar), the binary panics with an index out-of-bounds error instead of printing a helpful error message and exiting cleanly.

Fix

Check the length of os.Args before indexing into it in the command dispatch logic. Return a user-friendly error message instead of panicking.

Testing

  • Run observe unknowncmd — now prints an error and exits non-zero instead of panicking
  • Run observe with no args — behaviour unchanged

Co-authored-by: Aaron Brewbaker <abrewbaker@nhl.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant