helloworld

command
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2022 License: MIT Imports: 4 Imported by: 0

README

Hello World Example

This example shows how to define plugin interfaces, generate Go code and use it.

Generate Go code

A proto file is under ./greeting.

$ protoc --go-plugin_out=. --go-plugin_opt=paths=source_relative greeting/greet.proto 

Compile a plugin

Use TinyGo to compile the plugin to Wasm. This example contains two plugins, plugin-morning and plugin-evening.

$ tinygo build -o plugin-morning/morning.wasm -scheduler=none -target=wasi --no-debug plugin-morning/morning.go
$ tinygo build -o plugin-evening/evening.wasm -scheduler=none -target=wasi --no-debug plugin-evening/evening.go

Run

main.go loads the above two plugins.

$ go run main.go
Good morning, go-plugin
Good evening, go-plugin

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL