This devcontainer is configured to provide you a knqyf263/go-plugin's CLI tool installation,
Go and TinyGo toolchains, and a protobuf-compiler.
The sample code and following instructions are partially based on go-plugin's examples and go-plugin's tutorial.
Tested with protoc-gen-go-plugin 0.8.0,
protobuf-compiler 3.12.4, Go 1.21.7, TinyGo 0.30.0.
- Open this repo in devcontainer, e.g. using Github Codespaces. Type or copy/paste following commands to devcontainer's terminal.
- Generate the SDK codes based on interfaces declared in
protobufs/myschema.protofile:
cd protobufs
protoc --go-plugin_out=. --go-plugin_opt=paths=source_relative myschema.protoThis will generate 4 new .go files in protobufs directory.
- Compile the plugin sample:
cd ../plugin
tinygo build -o plugin.wasm -scheduler=none -target=wasi --no-debug plugin.goThis will generate plugin.wasm in plugin directory.
- Run the main ("host") program, which makes use of the
plugin.wasm:
cd ..
go run main.goPerform your own experiments if desired.
Created for (wannabe-awesome) list