Skip to content

Commit

Permalink
fix: change the read data func and add compileaot bool value
Browse files Browse the repository at this point in the history
Signed-off-by: shashank381 <[email protected]>
  • Loading branch information
shashank381 committed Apr 12, 2024
1 parent db2fb8d commit 78d4f49
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion maven-helmchartgen-wasm/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 2 additions & 5 deletions maven-helmchartgen-wasm/transformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion maven-helmchartgen-wasm/transformer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ spec:
move2kube.konveyor.io/built-in: "true"
config:
wasm_module: helmchartgen.wasm
execution_mode: compiler
compile_aot: true

0 comments on commit 78d4f49

Please sign in to comment.