Skip to content

Commit 2d98864

Browse files
authored
fix(go): casting unsafe pointer to uintptr type (#1493)
* fix(go): casting unsafe pointer to uintptr type when passed to wasm_import_* functions Signed-off-by: Andrew Steurer <[email protected]> * fix: update dev container to use patched version of Go Signed-off-by: Andrew Steurer <[email protected]> * feat: adding async resource func test Signed-off-by: Andrew Steurer <[email protected]> --------- Signed-off-by: Andrew Steurer <[email protected]>
1 parent 5bdc90e commit 2d98864

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

.devcontainer/setup.sh

100644100755
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
2929
echo 'export PATH="$HOME/.moon/bin:$PATH"' >> ~/.bashrc
3030

3131
# Go
32-
curl -OL https://go.dev/dl/go1.25.5.linux-amd64.tar.gz
33-
tar xf go1.25.5.linux-amd64.tar.gz
34-
echo "export PATH=$HOME/go1.25.5.linux-amd64/bin:\$PATH" >> ~/.bashrc
32+
GO="go-$(uname -s | tr 'A-Z' 'a-z')-$(uname -m | sed -e 's/aarch64/arm64/' -e 's/x86_64/amd64/')-bootstrap"
33+
curl -OL https://github.com/dicej/go/releases/download/go1.25.5-wasi-on-idle/$GO.tbz
34+
tar xf $GO.tbz
35+
rm $GO.tbz
36+
echo "export PATH=$HOME/$GO/bin:\$PATH" >> ~/.bashrc

crates/go/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ impl Go {
10061006
format!(
10071007
"{params_pointer} := wit_runtime.Allocate({PINNER}, {size}, {align})\n{code}"
10081008
),
1009-
vec![params_pointer],
1009+
vec![format!("uintptr({params_pointer})")],
10101010
)
10111011
} else {
10121012
let wasm_params = go_param_names

crates/test/src/cpp.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ impl LanguageMethods for Cpp {
5151
| "futures.wit"
5252
| "resources-with-futures.wit"
5353
| "resources-with-streams.wit"
54-
| "streams.wit" => true,
54+
| "streams.wit"
55+
| "async-resource-func.wit" => true,
5556
_ => false,
5657
}
5758
}

crates/test/src/csharp.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ impl LanguageMethods for Csharp {
4747
| "streams.wit"
4848
| "error-context.wit"
4949
| "resource-fallible-constructor.wit"
50+
| "async-resource-func.wit"
5051
)
5152
}
5253

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package foo:bar;
2+
3+
world bindings {
4+
import types;
5+
}
6+
7+
interface types {
8+
resource descriptor {
9+
test: async func(
10+
arg1: string,
11+
arg2: list<s32>,
12+
);
13+
}
14+
}

0 commit comments

Comments
 (0)