This is the Golang SDK for Easegress, it can be used to extend the ability of Easegress.
The following assumes that a recent version of Golang and compiler TinyGo are installed.
- Make a new directory and initialize a new module:
go mod init demo
- Init a go file:
echo '
package main
import (
"github.com/xmh19936688/easegress-go-sdk/easegress"
)
func init() {
easegress.Log(easegress.Info, "hello sdk")
}
func main() {
// keep empty
}
' > main.go
- Install the dependency:
go mod tidy
- Compile:
tinygo build -o demo.wasm -target wasi .
If everything is right, demo.wasm
will be generated.
Please refer the documentation of WasmHost
for deploying and executing the compiled Wasm code.