Functions SDK for Go

This small library is meant to be used inside a function
and provides helpers to use the injected functions and read the input.
Install
Dependencies
Usage
When developing a function in Go (function in the sense of Functions-api), you can access the input like this:
package main
import (
sdk "bitbucket.org/amotus/functions-sdk-go"
"fmt"
"os"
)
func main() {
input, err := sdk.ReadInput(os.Stdin)
if err != nil {
_, _ = os.Stderr.Write([]byte("failed reading input: " + err.Error()))
return
}
fmt.Println("Input: ")
fmt.Println(input.Input)
fmt.Println("Function ID: ")
fmt.Println(input.Context.FunctionID)
fmt.Println("Project ID: ")
fmt.Println(input.Context.ProjectID)
fmt.Println("Metadata: ")
fmt.Println(input.Metadata)
}
To access the injected function to send a message, see https://bitbucket.org/amotus/functions-api/src/develop/test/wasirunner/go/sdk/produce/
Development
Build
just build
Test
Since the code uses wasm features for go, tests must be ran through wasmtime. Thus wasmtime must be installed. Then the test
command below will take care of running those tests correctly:
just test
The injected functions are tested through this Functions-api sample
Releasing a new version
Please use the manual pipeline release-version that creates a new tag.
The pipeline will ask for a version, follow the vMAJOR.MINOR.PATCH format, possibly with a suffix if needed.
The next PR on this repository will update the changelog, so that the top version of the changelog is un-released (in development).
The manual changelog is just a simple list of features that were added or removed between each version.
Maintainers
Contributing
Readme convention
Repository convention
Language convention
Licence
Licensed under Apache License, Version 2.0 LICENSE.