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: crates/go/README.md
+26-9Lines changed: 26 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,18 @@
2
2
3
3
This tool generates Go bindings for a chosen WIT world.
4
4
5
+
## Contributing
6
+
7
+
If changes need to be made to the `go.bytecodealliance.org/pkg` files referenced by the generated bindings, here are the steps that need to be taken:
8
+
- Make the required changes to the [bytecodealliance/go-pkg](https://github.com/bytecodealliance/go-pkg) Go files and tag a release.
9
+
- Update the `crates/go/src/pkg` git submodule to reflect the most-recent release of `go-pkg`.
10
+
- Update the `REMOTE_PKG_VERSION` constant in [lib.rs](./src/lib.rs) to reflect the most-recent release of `go-pkg`.
11
+
- Make the required changes to `wit-bindgen-go`.
12
+
5
13
## Usage
6
14
15
+
The easiest way to use `wit-bindgen-go` is through the [componentize-go](https://github.com/bytecodealliance/componentize-go) tool. See below for using `wit-bindgen-go` directly.
16
+
7
17
To generate bindings with this crate, issue the `go` subcommand to `wit-bindgen`:
8
18
9
19
```bash
@@ -19,19 +29,24 @@ world provided:
19
29
- You can replace this with your own version (e.g. referencing third party dependencies) if desired
20
30
-`wit_bindings.go`: defines the `main` package for the module, including low-level, `//go:export`-annotated entrypoint functions corresponding to exported functions
21
31
- These entrypoint functions in turn call high-level functions which must be provided by the application developer
22
-
-`wit_runtime/wit_runtime.go`: defines low-level functions for supporting the component model ABI
23
32
-`<name>/wit_bindings.go`: defines any types generated for the interface named `<name>` (or `wit_world` for WIT types defined at the world level), plus any imported functions
24
33
- Note that the types placed in these files include all types for both imported and exported interfaces, except for exported resource types and any types which depend on exported resource types
25
34
-`export_<name>/wit_bindings.go`: defines intrinsics for use with any exported resource types generated for the interface named `<name>` (or `wit_world` for WIT types defined at the world level), plus any types which depend on those exported resource types, plus any exported functions
26
35
- The exported resource type definitions must be provided by the application developer
27
36
- The `export_<name>` package is also the place to define any exported functions
28
-
- (if needed) `wit_types/wit_tuples.go`: defines `Tuple<N>` types as required by the WIT world
29
-
- (if needed) `wit_types/wit_async.go`: defines low-level functions for integrating the Go scheduler with the component model async ABI
30
-
- (if needed) `wit_types/wit_option.go`: defines an `Option` type if required by the WIT world
31
-
- (if needed) `wit_types/wit_result.go`: defines an `Result` type if required by the WIT world
32
-
- (if needed) `wit_types/wit_unit.go`: defines an `Unit` type if required by the WIT world
33
-
- (if needed) `wit_types/wit_stream.go`: defines a `StreamReader` and `StreamWriter` types if required by the WIT world
34
-
- (if needed) `wit_types/wit_future.go`: defines a `FutureReader` and `FutureWriter` types if required by the WIT world
37
+
38
+
The generated files will reference the following files in the [bytecodealliance/go-pkg](https://github.com/bytecodealliance/go-pkg) repository:
39
+
40
+
-`go.bytecodealliance.org/pkg/wit/runtime`: defines low-level functions for supporting the component model ABI
0 commit comments