Go · Functions Implementation

Go with KERNSTACK functions

Go is KERNSTACK’s function language: handlers live at functions/{name}, compile to WebAssembly, and deploy with the routes that expose them declared in the same stack.json. This is the tightest loop on the platform — write the handler, kernstack serve it locally, read the plan, deploy the single function when only it changed.

Go Functions

The handler contract is one function: it receives the invoke request (HTTP calls, schedules, websocket events, and table change-stream batches share the shape) and returns a response or an error. Error and 5xx answers from change-stream handlers retry the batch, so handlers are written idempotently from the first version.

Everything around the code is declaration: routes, API keys, and domains in the gateway block; schedules on the function entry; the tables and buckets the handler uses as sibling resources. A reviewer reads the diff of code plus manifest and knows the complete public consequence of the change.

Metering follows execution only: 0.01 credits per GiB-second, nothing while idle, and scoped deploys (deploy --only function:api) keep the inner loop fast when a monorepo of functions grows.

CLI

Plan Go Functions, then deploy.

Terminal — CLI workflow kernstack cli
kernstack add function --name api --blueprint func-go-minimal
kernstack plan
kernstack deploy

Docs for Go Functions. Functions on the platform.

Frequently asked questions

No. The platform invokes the handler function directly with a typed request. Bring structure inside your handler package as the API grows; the deploy unit stays the function.

Yes. The request type tells the handler which trigger fired — change-stream events carry the table name, records with old and new items, and change ids for idempotency.

kernstack deploy --only function:api. Scoped deploys exist precisely so a large function surface does not make every change a full-stack event.

Ship your stack on the Software Lifecycle Cloud.

Closed preview on dedicated European infrastructure. Bring a repository or start from a blueprint.