majohn-r / mp3repair

An MP3 file repair command-line utility
MIT License
0 stars 0 forks source link

Redundant calls to os.Exit #150

Closed majohn-r closed 8 months ago

majohn-r commented 8 months ago

Each command calls os.Exit() when finishing, as does RunMain(). The RunMain() code is not, currently, actually reachable, as the command calling os.Exit() terminates program execution. This is unfortunate, as the RunMain() code also logs program termination, and the commands don't. Since the program termination logging depends on knowing when the program began execution, migrating that logic into a function that each command could call is not trivial, and new commands could easily forget to call it. Therefore, the commands should simply return an error that RunMain() would receive and understand, logging the embedded information and calling os.Exit() with an appropriate value.