Panic and Recover – Go Lang Practical Programming Tutorial p.21

The idea of panic is to halt the program and start to panic. This will stop the running function and run all of the deferred functions from the panicking function. The recover function lets you recover from a panicking goroutine. To recover a panicking goroutine, you would need to use recover from within one of the deferred functions of that goroutine.

Text tutorials and sample code:


Govardhan Hegde Kota says:

you teach nicely

Joydeep Mukherjee says:

I want to know how do you learn new programming languages, obviously i am gonna follow your tutorials but i just want to know how you got hooked up with Go?

Michi Lo says:

I was wondering for a few parts now: What is playing in that monitor in the background of your facecam video?
It looks like GTA, but nobody is playing…

EDIT: Is this Python plays GTA V? That would explain things…

Vincent de Jong says:

I still have no audio on your latest video’s, except for the S2000 MSR video. All other video’s on YouTube are fine. It’s really just your latest video’s. My audio isn’t muted or something, it’s specificly these video’s.
-edit- after searching for the last video with sound, I couldn’t find any other than the video about the S2000 MSR. Some time ago I said the same thing, but then I had sound until about video’s in the GTA series. This is so weird.

Rajeev Warrier says:

Hey Harrison, After this tutorial series will you go on to teach web development in Go? I love your tutorials!

Rolando Ariaga says:

Can I use Python to make mobile Apps for iOs?

asiddiqi123 says:

Go sentdex()
GO fmt.Println(“go!”)

Ice blast Grey says:

What ? No 720p or 480p quality ?

Abeltensor says:

You could defer wg.Done in the main func since wg is globally defined. Though actually that would probably error out. Generally when you want to defer multiple functions the way to do it is to build a closure and just defer them in that.

Something like defer func () { wg.Done() cleanup()}() would work in this case. You can embed wg.Done in cleanup as well since it runs when the go-routines panic.

 Write a comment


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!