program:
package main
import "fmt"
func main() {
fmt.Println("Before Function Foo Call")
foo()
fmt.Println("After Function Foo Call")
}
func foo() {
fmt.Println("Before Panic")
panic("foo function")
fmt.Println("After Panic")
}
output:
Before Function Foo Call
Before Panic
panic: foo function
goroutine 1 [running]:
panic(0x4b8e00, 0xc82000a340)
/home/godir/go/src/runtime/panic.go:464 +0x3e6
main.foo()
/home/godir/work/src/blog/example_panic/main.go:13 +0x11e
main.main()
/home/godir/work/src/blog/example_panic/main.go:7 +0xe3
No comments:
Post a Comment