If you were to add an ExitFunc func(int) field to the Logger struct, with a default implementation of func(int code) { os.Exit(code) }, it would become much easier to test code that calls Fatal*, by simply substituting the implementation with func(int code) { panic(...) } -- without having to resort to sub-process shenanigans that are complicated to implement and don't play well with -cover. Is this something you would be willing to implement / accept a PR for?
That would be indeed very useful, such a PR would be very welcome.
Be careful that the implementation behaviour must be backward compatible.
I'd like to give this a try
Hi @caalberts, your contributions will be welcome.
I raised a PR on this, do let me know if there is any concern.
I think this can be closed
Indeed, thanks again for your contribution.
Most helpful comment
I raised a PR on this, do let me know if there is any concern.