wasmerio / wasmer-go

🐹🕸️ WebAssembly runtime for Go

Home Page:https://pkg.go.dev/github.com/wasmerio/wasmer-go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No error print?

orangeC23 opened this issue · comments

commented

Summary

Related to https://github.com/wasmerio/wasmer-python/issues/713
The go file is:

package main

import (
	"fmt"
	"github.com/wasmerio/wasmer-go/wasmer"
	"io/ioutil"
)

func main() {
    wasmBytes, _ := ioutil.ReadFile("./tmp.wasm")

    engine := wasmer.NewEngine()
    store := wasmer.NewStore(engine)

    // Compiles the module
    module, err := wasmer.NewModule(store, wasmBytes)

    if err != nil {
        fmt.Println("Failed to compile module:", err)
    }

    importObject := wasmer.NewImportObject()
    instance, err := wasmer.NewInstance(module, importObject)

    if err != nil {
        panic(fmt.Sprintln("Failed to instantiate the module:", err))
    }
    start, err := instance.Exports.GetWasiStartFunction()

	start()

}

Additional details

wasmer go also print nothing, did not report the error as wasmer does.
wasmer go print:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4099a19]

goroutine 1 [running]:
main.main()
tmp.go:31 +0x119
exit status 2