import (
"fmt"
"os"
)
func main() {
fmt.Println("Start Main func()")
panic("a problem")
_, err := os.Create("/sss/sss")
if err != nil {
panic(err)
}
}
// 输出
Start Main func()
panic: a problem
goroutine 1 [running]:
main.main()
/Users/zengningzhong/Documents/souche/go/panic.go:18 +0x124
goroutine 2 [runnable]:
runtime.forcegchelper()
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/proc.go:90
runtime.goexit()
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/asm_amd64.s:2232 +0x1
goroutine 3 [runnable]:
runtime.bgsweep()
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/mgc0.go:82
runtime.goexit()
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/asm_amd64.s:2232 +0x1
goroutine 4 [runnable]:
runtime.runfinq()
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/malloc.go:712
runtime.goexit()
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/asm_amd64.s:2232 +0x1
exit status 2
shell returned 1
有疑问加站长微信联系(非本文作者)