Panics and exit codes

If the application terminates for a panic that is not recovered, then the deferred function will be executed, but the exit code will be 2:

package main

import (
"fmt"
)

func main() {
defer fmt.Println("Hello, playground")
panic("panic")
}

The full example is available at https://play.golang.org/p/mjOMb0KsM3e.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.182.76