xmh19936688 / easegress-go-sdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Easegress Golang SDK

This is the Golang SDK for Easegress, it can be used to extend the ability of Easegress.

Prerequisites

The following assumes that a recent version of Golang and compiler TinyGo are installed.

Local Development

  1. Make a new directory and initialize a new module:
go mod init demo
  1. 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
  1. Install the dependency:
go mod tidy
  1. Compile:
tinygo build -o demo.wasm -target wasi .

If everything is right, demo.wasm will be generated.

Deploy and execute

Please refer the documentation of WasmHost for deploying and executing the compiled Wasm code.

About

License:Apache License 2.0


Languages

Language:Go 100.0%