eminetto / clean-architecture-go-v2

Clean Architecture sample
1.28k stars 229 forks source link

log.Fatal call on main #17

Closed iurydias closed 2 years ago

iurydias commented 2 years ago

Hi @eminetto,

It is correct using log.Fatal on your main? Since it calls os.Exit and it will never run your defer functions (gracefully closing your database connection).

eminetto commented 2 years ago

Hi @iurydias,

Yes, you are right! Using log.Fatal, the defer isn't executed. In this case, using log.Panic is better because all the defer functions are performed as expected. I will change this in the main function. Thanks