runtime: signal SIGSEGV

This commit is contained in:
visualfc
2024-08-14 11:20:07 +08:00
parent cc9de01c99
commit 027d21035e
4 changed files with 71 additions and 0 deletions

24
cl/_testgo/sigsegv/in.go Normal file
View File

@@ -0,0 +1,24 @@
package main
type T struct {
s int
}
func f() *T {
return nil
}
func init() {
println("init")
defer func() {
r := recover()
if e, ok := r.(error); ok {
println("recover", e.Error())
}
}()
println(f().s)
}
func main() {
println("main")
}

View File

@@ -0,0 +1 @@
;