On 2/24/21 9:53 AM, roger peppe wrote:
> On Tue, 23 Feb 2021 at 12:10, Kevin Chadwick <
m8il...@gmail.com
> <mailto:
m8il...@gmail.com>> wrote:
>
> I only instigate panic manually for one thing. Perhaps that will change, but
> I doubt it.
>
> If I want to send out or write a log to disk then I will call panic rather
> than os.exit, upon a log.fatal scenario. Think buffered go routine logging.
> Saving the coder from having to think about it, once initialised.
>
> Which produces some ugly output and likely extra processing.
>
> Is it possible to call panic in a way that does not kill the process like
> os.Exit, but without log pollution?
>
> I am solely thinking of manually instigated panics, so a noop panic called
> something like terminate?
>
> Or is this bad practice, even when a program is in good operational order
> when instigated, as the OS is better at cleanup?
>
>
> Personally, I'd advise against using panic or log.Fatal in this kind of context
> - I'd just bite the bullet and return errors instead.
> This makes it easy to move code between contexts if you need to without worrying
> about non-local control flow.
>
then I want an immediate exit. To avoid any potential of fragility.
process is unlikely to fatal then a panic is unlikely to ever be seen. Perhaps