Go
The Go compile path is a managed runtime β you write a handler and register it with ignite.Start, and the platform compiles your package to a small static binary and runs it. The artifact is compact, so cold starts are fast. The platform owns the HTTP server, the listening port, and the readiness probe; you only write the handler.
Handler contract
A handler has this type, wired up by ignite.Start(handler) inside func main():
type Handler func(payload []byte, ctx *ignite.Context) ([]byte, error)A minimal idiomatic main.go (illustrative β there is no in-repo sample):
package main
import (
"encoding/json"
"ignite"
)
type request struct {
Name string `json:"name"`
}
func handler(payload []byte, ctx *ignite.Context) ([]byte, error) {
var req request
if err := json.Unmarshal(payload, &req); err != nil {
return nil, err
}
if req.Name == "" {
req.Name = "world"
}
return json.Marshal(map[string]string{
"greeting": "Hello, " + req.Name + "!",
"execution_id": ctx.ExecutionID,
"function_id": ctx.FunctionID,
})
}
func main() {
ignite.Start(handler)
}Context
ctx is an *ignite.Context with exported fields:
| Field | Type | Description |
|---|---|---|
ExecutionID | string | this invocationβs ID |
FunctionID | string | the app ID |
OrganizationID | string | the owning organizationβs ID |
Headers | http.Header | inbound request headers |
Input & output
payload is the raw request body as []byte β parse it yourself (for example with json.Unmarshal). The returned []byte is written to the response verbatim with content type application/octet-stream. A non-nil error return yields HTTP 500 with a JSON body of the form `{error}`.
Dependencies
Declare dependencies in go.mod at the archive root. Import the SDK as the package ignite; the platform resolves it at build time β the compiler rewrites that import to the bundled SDK, and runs go mod init / go mod tidy as part of the build.
Project layout
Ship an archive (zip / tar.gz) with your .go files and a go.mod at the root. The entrypoint is package main with a main() that calls ignite.Start(...); you need main.go plus go.mod at the root.
Logging
Use the standard library log package; its output goes to stderr.
What it compiles to
A static linux/amd64 binary, built with CGO_ENABLED=0 and `-ldflags="-s -w"` (symbol table and debug info stripped). Toolchain: Go 1.26.
Deploy
dodil ignite app create hello --runtime go
dodil ignite draft save org:hello --code ./
dodil ignite draft publish org:hello
dodil ignite invoke org:hello -p '{"name": "world"}'See also
- Code & Runtimes β the compile vs image paths
- Python compile contract
- Rust compile contract
- Deno compile contract
- Container images β bring or build your own container
- Quickstart