How to export wasm method from tinygo to allow spaces

60 Views Asked by At

I need the export wasm function to contain space, but the export fail

source file:

//go:export canister_query get
func get() uint32 {
    return 0
}

build cmd

tinygo build -o counter.wasm -target=wasm -scheduler=none -no-debug -panic=trap ./main.go

then convert the wasm file to wat fat, but the wat file doesn`t have an export canister_query get function

(export "canister_query get" (func $canister_query_get.command_export))

so I tried using underscore instead, and I can see the export method in the wat file.

//go:export canister_query_get
func get() uint32 {
    return 0
}

the new wat file contains the (export "canister_query_get" (func $canister_query_get.command_export))

I suspect that the compilation check fails. Is there any way to achieve this?

the go file:

//go:export canister_query get
func get() uint32 {
    return 0
}

Export method name correctly, contain space in the name

(export "canister_query get" (func $canister_query_get))
0

There are 0 best solutions below