Исходники и презентации
This commit is contained in:
21
lessons/errors/os_exit/main.go
Normal file
21
lessons/errors/os_exit/main.go
Normal file
@ -0,0 +1,21 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func process() {
|
||||
defer func() {
|
||||
recover()
|
||||
}()
|
||||
|
||||
fmt.Println("V2: open file")
|
||||
defer fmt.Println("V2: close file")
|
||||
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func main() {
|
||||
process()
|
||||
}
|
||||
Reference in New Issue
Block a user