Makes all examples and docs use Runtime.Close (#537)
This removes tedium in our examples and docs by using `Runtime.Close` instead of tracking everything. Internal tests still track too much, but anyway at least this stops suggesting others should do it. This also changes our examples to use log.PanicXX so that the line number goes into the console output. Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
@@ -27,7 +27,7 @@ func Example() {
|
||||
(export "add" (func $add))
|
||||
)`))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
log.Panicln(err)
|
||||
}
|
||||
defer mod.Close(ctx)
|
||||
|
||||
@@ -37,7 +37,7 @@ func Example() {
|
||||
x, y := uint64(1), uint64(2)
|
||||
results, err := add.Call(ctx, x, y)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
log.Panicln(err)
|
||||
}
|
||||
|
||||
fmt.Printf("%s: %d + %d = %d\n", mod.Name(), x, y, results[0])
|
||||
|
||||
Reference in New Issue
Block a user