Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,5 @@
func main() {
if problem {
return
}
}

View file

@ -0,0 +1,46 @@
package main
import (
"fmt"
"runtime"
"time"
)
const problem = true
func main() {
fmt.Println("main program start")
// this will get run on exit
defer paperwork()
// this will not run to completion
go pcj()
// this will not get run on exit
rec := &requiresExternalCleanup{"external object"}
runtime.SetFinalizer(rec, cleanup)
if problem {
fmt.Println("main program returning")
return
}
}
func paperwork() {
fmt.Println("i's dotted, t's crossed")
}
func pcj() {
fmt.Println("there's uncle Joe")
time.Sleep(1e10)
fmt.Println("movin kinda slow")
}
type requiresExternalCleanup struct {
id string
}
func cleanup(rec *requiresExternalCleanup) {
fmt.Println(rec.id, "cleanup")
}

View file

@ -0,0 +1,13 @@
func main() {
fmt.Println("main program start")
// this will not get run on os.Exit
defer func() {
fmt.Println("deferred function")
}()
if problem {
fmt.Println("main program exiting")
os.Exit(-1)
}
}

View file

@ -0,0 +1,17 @@
func pcj() {
fmt.Println("at the junction")
defer func() {
fmt.Println("deferred from pcj")
}()
panic(10)
}
func main() {
fmt.Println("main program start")
defer func() {
fmt.Println("deferred from main")
}()
go pcj()
time.Sleep(1e9)
fmt.Println("main program done")
}