how is log.Panic useful?

152 views
Skip to first unread message

Anmol Sethi

unread,
Jul 24, 2016, 8:42:24 PM7/24/16
to golang-nuts
I cannot seem to think of many situations where log.Panic is very useful. Can someone provide a quick example?

Matt Harden

unread,
Jul 24, 2016, 9:56:53 PM7/24/16
to Anmol Sethi, golang-nuts

I use it in main() in short scripts to handle errors when I don't expect them to ever occur. It's just a shortcut for log.Error followed by panic. Similar to log.Fatal.


On Sun, Jul 24, 2016, 17:42 Anmol Sethi <an...@aubble.com> wrote:
I cannot seem to think of many situations where log.Panic is very useful. Can someone provide a quick example?

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Christoph Seufert

unread,
Jul 25, 2016, 12:10:45 AM7/25/16
to golang-nuts
In startup situation when you like to grab the extra information about all the goroutines that might already have been started. Those are situations where i regularly panic, because i somethings goes wrong there i want to grab all the possible information i can.
Reply all
Reply to author
Forward
0 new messages