-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use log.Print, not log.Fatal in the main #14
Comments
sofasurfa
changed the title
Use log.Print, not log.Fatal
Use log.Print, not log.Fatal in the main
Oct 22, 2020
Apologies for the delay and thanks for the PR. Left a comment on the PR. Do take a look and let me know your thoughts. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@spy16 Also I noticed that
defer closeSession()
wouldn't execute in the main.As
Fatalf
logs the error and then callsos.Exit(1)
.I think it's better to do this
Another option would be to use
panic()
instead oflg.Fatalf()
every where, and then at the bottom of main we could recover panics...This methods creates a centralised place for our clean ups, but it does require to use
panic
for every error that occurs in the main. So it's not very clean, and it kind of goes against the purpose of panic... thus I think method 1 is better.What do you think?
The text was updated successfully, but these errors were encountered: