Removal of Fatal(s) to enable deferred calls execution
The log.Fatal
function executes os.Exit(1)
under the hood and terminates binary immediately without running any finalisation. So all defer
red function calls won't run and could lead to problems with available volume, file structure, etc.
We replace usages of it with panic
or something else applicable in the context and do some refactoring of the service initialisation by moving initialisations inside of the func and returning an error from it instead of calling Fatal
.