diff --git a/maven-helmchartgen-wasm/README.md b/maven-helmchartgen-wasm/README.md index 21c3c14..6371676 100644 --- a/maven-helmchartgen-wasm/README.md +++ b/maven-helmchartgen-wasm/README.md @@ -1,6 +1,6 @@ # How to build this WASM Transformer -1. Ensure you have the [TinyGo](https://tinygo.org/) compiler installed. Move2Kube WASM modules currently do not support WASI modules built by the Go compiler. +1. Ensure you have the [TinyGo](https://tinygo.org/) compiler installed. The official Golang compiler doesn't fully support WASM exports yet https://github.com/golang/go/issues/65199 2. Run the following command: ``` $ tinygo build -o helmchartgen.wasm -target=wasi transformer.go diff --git a/maven-helmchartgen-wasm/transformer.go b/maven-helmchartgen-wasm/transformer.go index 26ff0b1..0010b66 100644 --- a/maven-helmchartgen-wasm/transformer.go +++ b/maven-helmchartgen-wasm/transformer.go @@ -28,11 +28,8 @@ func pack(pointer uint32, size uint32) uint64 { func readData(dataPointer uint64) string { pointer, size := unpack(dataPointer) - bytes := make([]byte, size) - for i := uint32(0); i < size; i++ { - bytes[i] = *(*byte)(unsafe.Pointer(uintptr(pointer) + uintptr(i))) - } - return string(bytes) + dataStr := unsafe.String((*byte)(unsafe.Pointer(uintptr(pointer))), size) + return strings.Clone(dataStr) } //export directoryDetect diff --git a/maven-helmchartgen-wasm/transformer.yaml b/maven-helmchartgen-wasm/transformer.yaml index 2132696..92a2fff 100644 --- a/maven-helmchartgen-wasm/transformer.yaml +++ b/maven-helmchartgen-wasm/transformer.yaml @@ -16,4 +16,4 @@ spec: move2kube.konveyor.io/built-in: "true" config: wasm_module: helmchartgen.wasm - execution_mode: compiler \ No newline at end of file + compile_aot: true \ No newline at end of file