kolide / launcher

Osquery launcher, autoupdater, and packager
https://kolide.com/launcher
Other
500 stars 99 forks source link

Forbid use of panic inside launcher #1697

Closed RebeccaMahany closed 2 months ago

RebeccaMahany commented 2 months ago

Per discussion here https://github.com/kolide/launcher/pull/1693#discussion_r1583340281 -- since we no longer allow os.Exit and logutil.Fatal, we should disallow calls to panic as well. This PR makes that change.

In places where we panic when receiving an unexpected enum, the most correct implementation alternative I found was compile-time safety for enums in Go.

Areas of interest for testing - Osquery log publishing - Tables: - kolide_plist - kolide_json - kolide_jsonl - kolide_jwt - kolide_xml - kolide_ini - kolide_nmcli_wifi (Linux)
Don't panic ![image](https://github.com/kolide/launcher/assets/8119675/c7ab79a0-f6da-4477-bdf4-60b7174f2990)