You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,14 @@ Developing and testing this package requires an up-to-date installation of [Go](
10
10
11
11
Tests are supported under both Go and TinyGo, on Linux, macOS, and WebAssembly.
12
12
13
-
```sh
13
+
```console
14
14
go test ./...
15
15
tinygo test ./...
16
16
```
17
17
18
18
Testing with WebAssembly (`wasip1`) requires an installation of [`go_wasip1_wasm32_exec`](https://go.dev/blog/wasi) and [Wasmtime](https://wasmtime.dev). WASI 0.2 `wasip2` is supported under TinyGo version 0.33.0 or later.
19
19
20
-
```sh
20
+
```console
21
21
GOARCH=wasm GOOS=wasip1 go test ./...
22
22
GOARCH=wasm GOOS=wasip1 tinygo test ./...
23
23
tinygo test -target=wasip2 ./... # requires TinyGo 0.33.0 or later
[WebAssembly](https://webassembly.org), [WASI](https://wasi.dev), and [Component Model](https://component-model.bytecodealliance.org/) modules for [Go](https://go.dev) and [TinyGo](https://tinygo.org).
5
4
6
-
A monorepo of [WebAssembly](https://webassembly.org), [WASI](https://wasi.dev), and [Component Model](https://component-model.bytecodealliance.org/) modules for [Go](https://go.dev) and [TinyGo](https://tinygo.org).
This repository contains code to generate Go bindings for [Component Model](https://component-model.bytecodealliance.org/) interfaces defined in [WIT](https://component-model.bytecodealliance.org/design/wit.html) (WebAssembly Interface Type) files. A goal of this project is to accelerate adoption of the Component Model and development of [WASI 0.2+](https://bytecodealliance.org/articles/WASI-0.2) in Go.
9
+
Package `wit/bindgen` contains code to generate Go bindings for [Component Model](https://component-model.bytecodealliance.org/) interfaces defined in [WIT](https://component-model.bytecodealliance.org/design/wit.html) (WebAssembly Interface Type) files. A goal of this project is to accelerate adoption of the Component Model and development of [WASI 0.2+](https://bytecodealliance.org/articles/WASI-0.2) in Go.
11
10
12
11
### Component Model
13
12
14
-
Package [cm](./cm) contains helper types and functions used by generated packages, such as `option<t>`, `result<ok, err>`, `variant`, `list`, and `resource`. These are intended for use by generated [Component Model](https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#type-definitions) bindings, where the caller converts to a Go equivalent. It attempts to map WIT semantics to their equivalent in Go where possible.
13
+
Package `cm` contains helper types and functions used by generated packages, such as `option<t>`, `result<ok, err>`, `variant`, `list`, and `resource`. These are intended for use by generated [Component Model](https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#type-definitions) bindings, where the caller converts to a Go equivalent. It attempts to map WIT semantics to their equivalent in Go where possible.
15
14
16
15
#### Note on Memory Safety
17
16
@@ -23,41 +22,41 @@ Package `cm` and generated bindings from `wit-bindgen-go` may have compatibility
23
22
24
23
The `wit-bindgen-go` tool can generate Go bindings for WIT interfaces and worlds. If [`wasm-tools`](https://crates.io/crates/wasm-tools) is installed and in `$PATH`, then `wit-bindgen-go` can load WIT directly.
25
24
26
-
```sh
25
+
```console
27
26
wit-bindgen-go generate ../wasi-cli/wit
28
27
```
29
28
30
29
Otherwise, pass the JSON representation of a fully-resolved WIT package:
For debugging purposes, `wit-bindgen-go` can also convert a JSON representation back into WIT. This is useful for validating that the intermediate representation faithfully represents the original WIT source.
45
44
46
-
```sh
45
+
```console
47
46
wit-bindgen-go wit example.wit.json
48
47
```
49
48
50
49
### WIT → JSON
51
50
52
-
The [wit](./wit) package can decode a JSON representation of a fully-resolved WIT file. Serializing WIT into JSON requires [wasm-tools](https://crates.io/crates/wasm-tools) v1.210.0 or higher. To convert a WIT file into JSON, run `wasm-tools` with the `-j` argument:
51
+
Package `wit` can decode a JSON representation of a fully-resolved WIT file. Serializing WIT into JSON requires [wasm-tools](https://crates.io/crates/wasm-tools) v1.210.0 or higher. To convert a WIT file into JSON, run `wasm-tools` with the `-j` argument:
Copy file name to clipboardExpand all lines: RELEASE.md
+7-6Lines changed: 7 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -2,20 +2,21 @@
2
2
3
3
This document describes the steps to release a new version of the `wit-bindgen-go` CLI.
4
4
5
-
## 1. Update the [CHANGELOG.md](./CHANGELOG.md)
5
+
## 1. Update [CHANGELOG.md](./CHANGELOG.md)
6
6
7
-
* Add the latest changes to CHANGELOG.md.
8
-
* Rename the Unreleased section to reflect the new version number.
9
-
* Update the links to new version tag in the footer of CHANGELOG.md
10
-
* Submit a pull request (PR) with these updates.
7
+
1. Add the latest changes to [CHANGELOG.md](./CHANGELOG.md).
8
+
1. Rename the Unreleased section to reflect the new version number.
9
+
1. Update the links to new version tag in the footer of CHANGELOG.md
10
+
1. Add today’s date (YYYY-MM-DD) after an em dash (—).
11
+
1. Submit a [GitHub Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) with these updates.
11
12
12
13
## 2. Create a new release
13
14
14
15
Once the PR is merged, tag the new version in Git and push the tag to GitHub.
// Package cabi contains a single WebAssembly function exported as cabi_realloc.
2
+
//
3
+
// To use, import this package with _:
4
+
//
5
+
// import _ "go.bytecodealliance.org/x/cabi"
6
+
//
7
+
// Function realloc is a WebAssembly [core function] that is validated to have the following core function type:
8
+
//
9
+
// (func (param $originalPtr i32)
10
+
// (param $originalSize i32)
11
+
// (param $alignment i32)
12
+
// (param $newSize i32)
13
+
// (result i32))
14
+
//
15
+
// The [Canonical ABI] will use realloc both to allocate (passing 0 for the first two parameters) and reallocate. If the Canonical ABI needs realloc, validation requires this option to be present (there is no default).
0 commit comments