Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -2,18 +2,21 @@ package main
|
|||
|
||||
import "fmt"
|
||||
|
||||
func foo() {
|
||||
fmt.Println("let's foo...")
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
fmt.Printf("Error: %v\n", err)
|
||||
}
|
||||
}()
|
||||
panic("FAIL!")
|
||||
fmt.Println("there's no point in going on.")
|
||||
func foo() int {
|
||||
fmt.Println("let's foo...")
|
||||
defer func() {
|
||||
if e := recover(); e != nil {
|
||||
fmt.Println("Recovered from", e)
|
||||
}
|
||||
}()
|
||||
var a []int
|
||||
a[12] = 0
|
||||
fmt.Println("there's no point in going on.")
|
||||
panic("never reached")
|
||||
panic(fmt.Scan) // Can use any value, here a function!
|
||||
}
|
||||
|
||||
func main() {
|
||||
foo()
|
||||
fmt.Println("glad that's over.")
|
||||
foo()
|
||||
fmt.Println("glad that's over.")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue