Skip to content

Commit 6b4d618

Browse files
committed
docs(go): update docs - add go information
1 parent a0426d5 commit 6b4d618

File tree

2 files changed

+54
-20
lines changed

2 files changed

+54
-20
lines changed

README.md

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ There are two kinds of hosts:
2323
Those hosts then run the same codebase which is compiled to WebAssembly:
2424

2525
- the REPL logic
26-
- the plugins (made a few in rust, C and TypeScript)
26+
- the plugins (made a few in rust, C, Go, and TypeScript)
2727

2828
Security model: the REPL cli implements a security model inspired by [deno](https://docs.deno.com/runtime/fundamentals/security/#permissions):
2929

@@ -84,6 +84,7 @@ pluginlab\
8484
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_cat.wasm\
8585
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_tee.wasm\
8686
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin-echo-c.wasm\
87+
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin-echo-go.wasm\
8788
--allow-all
8889
```
8990

@@ -109,6 +110,7 @@ pluginlab\
109110
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_cat.wasm\
110111
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_tee.wasm\
111112
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin-echo-c.wasm\
113+
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin-echo-go.wasm\
112114
--allow-all
113115
[Host] Starting REPL host...
114116
[Host] Loading REPL logic from: https://topheman.github.io/webassembly-component-model-experiments/plugins/repl_logic_guest.wasm
@@ -119,6 +121,7 @@ pluginlab\
119121
[Host] Loading plugin: https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_cat.wasm
120122
[Host] Loading plugin: https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_tee.wasm
121123
[Host] Loading plugin: https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin-echo-c.wasm
124+
[Host] Loading plugin: https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin-echo-go.wasm
122125
repl(0)> echo foo
123126
foo
124127
repl(0)> echo $ROOT/$USER
@@ -159,6 +162,7 @@ Go check [topheman.github.io/webassembly-component-model-experiments](https://to
159162

160163
- Rust 1.87+
161164
- Node.js 22.6.0+ (needs `--experimental-strip-types` flag)
165+
- Go 1.25+
162166
- [just](https://github.com/casey/just?tab=readme-ov-file#installation)
163167

164168
### Setup
@@ -199,6 +203,17 @@ cargo binstall wasm-tools@1.235.0
199203
just dl-wasi-sdk
200204
```
201205

206+
#### Go tooling
207+
208+
[From the WebAssembly Component Model section for Go tooling](https://component-model.bytecodealliance.org/language-support/go.html)
209+
210+
- Install [TinyGo](https://tinygo.org/getting-started/install/)
211+
- Install [wasm-tools](https://github.com/bytecodealliance/wasm-tools) - same as C
212+
- Install [wkg](https://github.com/bytecodealliance/wasm-pkg-tools)
213+
```bash
214+
cargo binstall wkg
215+
```
216+
202217
### pluginlab (rust) - REPL cli host
203218

204219
#### Build
@@ -226,13 +241,14 @@ This will (see [justfile](./justfile)):
226241
--plugins ./target/wasm32-wasip1/debug/plugin_cat.wasm\
227242
--plugins ./target/wasm32-wasip1/debug/plugin_tee.wasm\
228243
--plugins ./c_modules/plugin-echo/plugin-echo-c.wasm\
244+
--plugins ./go_modules/plugin-echo-go/plugin-echo-go.wasm\
229245
--allow-all
230246
```
231247

232248
This will run the `pluginlab` binary which will itself:
233249

234250
- load and compile the `repl_logic_guest.wasm` file inside the embedded `wasmtime` engine injecting the [`host-api`](./crates/pluginlab/wit/host-api.wit) interface
235-
- load and compile the `plugin_*.wasm` files into the engine, injecting the [`plugin-api`](./crates/pluginlab/wit/plugin-api.wit) interface
251+
- load and compile the `plugin*.wasm` files passed via `--plugins` into the engine, injecting the [`plugin-api`](./crates/pluginlab/wit/plugin-api.wit) interface
236252
- launch the REPL loop executing the code from the `repl_logic_guest.wasm` file which will:
237253
- readline from the user
238254
- parse the command
@@ -336,7 +352,7 @@ To be sure that the preview server is up and running before running the tests, w
336352

337353
### plugins
338354

339-
There are currently plugins implemented in 3 languages (most of them are in rust):
355+
There are currently plugins implemented in 3 languages (most of them are in rust), their toolchain is already setup in the project, you just have to write the plugin code and run `just build`.
340356

341357
#### Rust
342358

@@ -346,6 +362,10 @@ You can write plugins in rust in [`crates/plugin-*`](./crates).
346362

347363
You can write plugins in C in [`c_modules/plugin-*`](./c_modules), thanks to `wit-bindgen` (based on [wit-bindgen](https://github.com/bytecodealliance/wit-bindgen)).
348364

365+
#### Go
366+
367+
You can write plugins in Go in [`go_modules/plugin-*`](./go_modules), thanks to [TinyGo Compiler](https://tinygo.org/getting-started/install/).
368+
349369
#### TypeScript
350370

351371
You can also write plugins in TypeScript in [`packages/plugin-*`](./packages), thanks to `jco componentize` (based on [componentize-js](https://github.com/bytecodealliance/componentize-js)).
@@ -383,14 +403,15 @@ When a git tag is pushed, a pre-release is prepared on github, linked to the tag
383403

384404
```sh
385405
pluginlab\
386-
--repl-logic https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.0/repl_logic_guest.wasm\
387-
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.0/plugin_greet.wasm\
388-
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.0/plugin_ls.wasm\
389-
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.0/plugin_echo.wasm\
390-
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.0/plugin_weather.wasm\
391-
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.0/plugin_cat.wasm\
392-
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.0/plugin_tee.wasm\
393-
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.0/plugin-echo-c.wasm\
406+
--repl-logic https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.2/repl_logic_guest.wasm\
407+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.2/plugin_greet.wasm\
408+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.2/plugin_ls.wasm\
409+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.2/plugin_echo.wasm\
410+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.2/plugin_weather.wasm\
411+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.2/plugin_cat.wasm\
412+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.2/plugin_tee.wasm\
413+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.2/plugin-echo-c.wasm\
414+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.2/plugin-echo-go.wasm\
394415
--allow-all
395416
```
396417

@@ -444,3 +465,10 @@ cargo binstall cargo-component@0.21.1 wasm-tools@1.235.0 wasm-opt@116
444465
- [From the WebAssembly Component Model section for C tooling](https://component-model.bytecodealliance.org/language-support/c.html)
445466
- [WASI SDK](https://github.com/WebAssembly/wasi-sdk)
446467
- [WIT Bindgen](https://github.com/bytecodealliance/wit-bindgen)
468+
469+
### Go tooling
470+
471+
- [From the WebAssembly Component Model section for Go tooling](https://component-model.bytecodealliance.org/language-support/go.html)
472+
- [TinyGo Compiler](https://tinygo.org/getting-started/install/)
473+
- [wasm-tools](https://github.com/bytecodealliance/wasm-tools)
474+
- [wkg](https://github.com/bytecodealliance/wasm-pkg-tools)

crates/pluginlab/README.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ There are two kinds of hosts:
1818
Those hosts then run the same codebase which is compiled to WebAssembly:
1919

2020
- the REPL logic
21-
- the plugins (made a few in rust, C and TypeScript)
21+
- the plugins (made a few in rust, C, Go, and TypeScript)
2222

2323
Security model: the REPL cli implements a security model inspired by [deno](https://docs.deno.com/runtime/fundamentals/security/#permissions):
2424

@@ -63,6 +63,7 @@ pluginlab\
6363
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_cat.wasm\
6464
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_tee.wasm\
6565
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin-echo-c.wasm\
66+
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin-echo-go.wasm\
6667
--allow-all
6768
```
6869

@@ -88,6 +89,7 @@ pluginlab\
8889
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_cat.wasm\
8990
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_tee.wasm\
9091
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin-echo-c.wasm\
92+
--plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin-echo-go.wasm\
9193
--allow-all
9294
[Host] Starting REPL host...
9395
[Host] Loading REPL logic from: https://topheman.github.io/webassembly-component-model-experiments/plugins/repl_logic_guest.wasm
@@ -96,6 +98,9 @@ pluginlab\
9698
[Host] Loading plugin: https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_echo.wasm
9799
[Host] Loading plugin: https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_weather.wasm
98100
[Host] Loading plugin: https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_cat.wasm
101+
[Host] Loading plugin: https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_tee.wasm
102+
[Host] Loading plugin: https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin-echo-c.wasm
103+
[Host] Loading plugin: https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin-echo-go.wasm
99104
repl(0)> echo foo
100105
foo
101106
repl(0)> echo $ROOT/$USER
@@ -135,14 +140,15 @@ The plugins are also versioned in [github releases](https://github.com/topheman/
135140
<summary>Example of running the CLI host with old versions of the plugins (if you have an old version of <code>pluginlab</code></summary>
136141
<pre>
137142
pluginlab\
138-
--repl-logic https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.0/repl_logic_guest.wasm\
139-
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.0/plugin_greet.wasm\
140-
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.0/plugin_ls.wasm\
141-
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.0/plugin_echo.wasm\
142-
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.0/plugin_weather.wasm\
143-
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.0/plugin_cat.wasm\
144-
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.0/plugin_tee.wasm\
145-
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.0/plugin-echo-c.wasm\
143+
--repl-logic https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.2/repl_logic_guest.wasm\
144+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.2/plugin_greet.wasm\
145+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.2/plugin_ls.wasm\
146+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.2/plugin_echo.wasm\
147+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.2/plugin_weather.wasm\
148+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.2/plugin_cat.wasm\
149+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.2/plugin_tee.wasm\
150+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.2/plugin-echo-c.wasm\
151+
--plugins https://github.com/topheman/webassembly-component-model-experiments/releases/download/pluginlab@0.5.2/plugin-echo-go.wasm\
146152
--allow-all
147153
</pre>
148154
</summary>

0 commit comments

Comments
 (0)