/*
protect is basically a try except - If g may cause an error, call it
through protect, so execution won't break if g encounters a panic.
*/
protect is basically a try except - If g may cause an error, call it
through protect, so execution won't break if g encounters a panic.
/ * protect is basically a try except - If g may cause an error call it through protect so execution won ' t break if g encounters a panic . * /
func protect(g func()) {
	defer func() {
		log.Println("done")  
		if x := recover(); x != nil {
			log.Printf("run time panic: %v", x)
		}
	}()
	log.Println("start")
	g()
}
func protect ( g func ( ) ) { defer func ( ) { log . Println ( " " ) if x := recover ( ) ; x != nil { log . Printf ( " " , x ) } } ( ) log . Println ( " " ) g ( ) }
protect is basically a try except - If g may cause an error, call it
through protect, so execution won't break if g encounters a panic.
protect is basically a try except - If g may cause an error call it through protect so execution won ' t break if g encounters a panic .
// Println executes normally even if there is a panic