wasmer-go icon indicating copy to clipboard operation
wasmer-go copied to clipboard

No error print?

Open orangeC23 opened this issue 1 year ago • 0 comments

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

orangeC23 avatar Apr 11 '23 04:04 orangeC23