Skip to content

Commit 2afc9f5

Browse files
committed
chore: bump wit-bindgen-go version
Signed-off-by: Andrew Steurer <94206073+asteurer@users.noreply.github.com>
1 parent ba0b616 commit 2afc9f5

7 files changed

Lines changed: 53 additions & 45 deletions

File tree

Cargo.lock

Lines changed: 27 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ allow_attributes_without_reason = 'warn'
3737
anyhow = { workspace = true}
3838
clap = { version = "4.5.53", features = ["derive"] }
3939
regex = "1.12.2"
40-
wat = { version = "1.243.0"}
41-
# TODO: Update once v0.52.0 releases
42-
wit-bindgen-go = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "822fdb1ae6279933be9f0a6b18901adf9997398d" }
43-
wit-component = "0.244.0"
44-
wit-parser = "0.244.0"
40+
wat = { version = "1.245.1"}
41+
wit-bindgen-go = { git = "https://github.com/asteurer/wit-bindgen", rev = "ad98571fdd93de6057c4572e16ba5c6f5ac17ae7" }
42+
wit-component = "0.245.1"
43+
wit-parser = "0.245.1"

examples/wasip2/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
### Prerequisites
44
- [**componentize-go**](https://github.com/bytecodealliance/componentize-go) - Latest version
55
- [**go**](https://go.dev/dl/) - v1.25+
6-
- [**wasmtime**](https://github.com/bytecodealliance/wasmtime) - Latest version
6+
- [**wasmtime**](https://github.com/bytecodealliance/wasmtime) - v40.0.2
77

88
### Run
99
```sh

examples/wasip2/export_wasi_http_incoming_handler/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package export_wasi_http_incoming_handler
33
import (
44
. "wit_component/wasi_http_types"
55

6-
. "github.com/bytecodealliance/wit-bindgen/wit_types"
6+
. "go.bytecodealliance.org/pkg/wit/types"
77
)
88

99
// Handle the specified `Request`, returning a `Response`

examples/wasip3/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ everything is merged, we'll be able to switch to the upstream releases.
1414
### Prerequisites
1515
- [**componentize-go**](https://github.com/bytecodealliance/componentize-go) - Latest version
1616
- [**go**](https://github.com/dicej/go/releases/tag/go1.25.5-wasi-on-idle) - The [Makefile](./Makefile) installs the patched version of Go.
17-
- [**wasmtime**](https://github.com/bytecodealliance/wasmtime) - Latest version
17+
- [**wasmtime**](https://github.com/bytecodealliance/wasmtime) - v40.0.2
1818

1919
This will build the dependencies, generate Go bindings from the
2020
`wasi:http@0.3.0-rc-2025-09-16` WIT files, build the component, and run it using

examples/wasip3/export_wasi_http_handler/handler.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"wit_component/wasi_http_handler"
99
. "wit_component/wasi_http_types"
1010

11-
. "github.com/bytecodealliance/wit-bindgen/wit_types"
11+
. "go.bytecodealliance.org/pkg/wit/types"
1212
)
1313

1414
// Handle the specified `Request`, returning a `Response`
@@ -58,7 +58,7 @@ func Handle(request *Request) Result[*Response, ErrorCode] {
5858
channel := make(chan Tuple2[string, string])
5959
for _, url := range urls {
6060
go func() {
61-
channel <- Tuple2[string, string]{url, getSha256(url)}
61+
channel <- Tuple2[string, string]{F0: url, F1: getSha256(url)}
6262
}()
6363
}
6464

@@ -70,7 +70,7 @@ func Handle(request *Request) Result[*Response, ErrorCode] {
7070

7171
response, send := ResponseNew(
7272
FieldsFromList([]Tuple2[string, []uint8]{
73-
Tuple2[string, []uint8]{"content-type", []uint8("text/plain")},
73+
{F0: "content-type", F1: []uint8("text/plain")},
7474
}).Ok(),
7575
Some(rx),
7676
trailersFuture(),

src/bindings.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub fn generate_bindings(
1313
output: Option<&Path>,
1414
pkg_name: Option<String>,
1515
) -> Result<()> {
16-
let (resolve, world) = parse_wit(wit_path, world, features, all_features)?;
16+
let (mut resolve, world) = parse_wit(wit_path, world, features, all_features)?;
1717
let mut files = Default::default();
1818

1919
let format = if should_format {
@@ -22,14 +22,24 @@ pub fn generate_bindings(
2222
wit_bindgen_go::Format::False
2323
};
2424

25+
// If the user wants to create a package rather than a standalone binary, provide them with the
26+
// go.bytecodealliance.org/pkg version that needs to be placed in their go.mod file
27+
let mut message: Option<String> = None;
28+
if pkg_name.is_some() {
29+
message = Some(format!(
30+
"Success! Please add the following line to your 'go.mod' file:\n\nrequire {}",
31+
wit_bindgen_go::remote_pkg_version()
32+
));
33+
}
34+
2535
wit_bindgen_go::Opts {
2636
generate_stubs,
2737
format,
2838
pkg_name,
2939
..Default::default()
3040
}
3141
.build()
32-
.generate(&resolve, world, &mut files)?;
42+
.generate(&mut resolve, world, &mut files)?;
3343

3444
let output_path = match output {
3545
Some(p) => make_path_absolute(&p.to_path_buf())?,
@@ -45,5 +55,9 @@ pub fn generate_bindings(
4555
std::fs::write(&file_path, contents)?;
4656
}
4757

58+
if let Some(msg) = message {
59+
println!("{msg}");
60+
}
61+
4862
Ok(())
4963
}

0 commit comments

Comments
 (0)