The Go SDK Is Here

The Go SDK Is Here

Tako-kun·

Channels update, November 15, 2026: The channel section below now reflects params-scoped streams and separate WS/SSE URLs. Go supplies backend registration and authorization; the JavaScript browser client supplies shared WS subscriptions. See the current Channels reference for SDK capabilities.

Here’s a complete Go app on Tako:

package main

import (
  "net/http"
  "tako.sh"
)

func main() {
  mux := http.NewServeMux()
  mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
    w.Write([]byte("Hello from Tako"))
  })
  tako.ListenAndServe(mux)
}

That’s it. tako init, tako deploy, done. The tako.sh Go module is now available — Go joins JavaScript/TypeScript as a first-class Tako runtime.

One Interface: http.Handler

The JavaScript SDK is built around the fetch handler pattern — one function, every runtime. For Go, the equivalent is http.Handler. It’s the interface that every Go web framework already implements.

That means the integration is a single line:

// Gin
r := gin.Default()
tako.ListenAndServe(r)

// Echo
e := echo.New()
tako.ListenAndServe(e)

// Chi
r := chi.NewRouter()
tako.ListenAndServe(r)

No adapters. No wrappers. No glue code. If your framework implements http.Handler, it works. Gin, Echo, Chi, gorilla/mux, plain net/http — pass it to ListenAndServe and Tako handles the rest.

Fiber uses fasthttp instead of net/http. For custom server loops, tako.Listener() returns a bound net.Listener and reports readiness, but does not install HTTP protocol handling. The framework must handle authenticated internal status requests itself.

Same Protocol, Same Guarantees

The Go SDK speaks the exact same Tako protocol as the JavaScript SDK. Everything we built the SDK for works identically:

ConcernWhat the SDK does
ReadinessWrites the bound port to fd 4 after the listener is ready
Health checksIntercepts Host: <app>.tako with /status endpoint automatically
SecretsReads from fd 3 at init — before your code runs
Graceful shutdownCatches SIGTERM/SIGINT, drains in-flight requests for 10 seconds
Metadatatako.InstanceID(), tako.Version(), tako.Uptime() for observability

The server doesn’t care whether the process behind the socket is Go, Bun, or Node. It waits for the fd-4 port report, probes the authenticated internal /status, and routes traffic. One protocol, focused runtimes.

Type-Safe Secrets

Go’s approach to secrets leans into the type system. Run tako generate and it generates a tako_secrets.go file with a typed struct:

// Generated by tako generate — DO NOT EDIT.
var Secrets = struct {
  DatabaseUrl func() string
  ApiKey      func() string
}{
  DatabaseUrl: func() string { return tako.GetSecret("DATABASE_URL") },
  ApiKey:      func() string { return tako.GetSecret("API_KEY") },
}

Autocompletion in your editor. Compile-time errors if you typo a secret name. No more os.Getenv("DATABSE_URL") bugs that only surface in production.

Secrets come from one place: the fd 3 bootstrap envelope Tako hands to your process at startup. The same tako secrets set … values work in tako dev and tako deploy, with no environment-variable ambiguity.

Channels

The root tako.sh Go module registers channel definitions and serves their authorization callbacks. This example uses the default receive-only SSE transport:

import (
  "encoding/json"
  "tako.sh"
)

tako.Channels.Register("chat", tako.ChannelDefinition{
  ParamsSchema: []byte(`{
    "type": "object",
    "properties": { "roomId": { "type": "string" } },
    "required": ["roomId"]
  }`),
  Auth: &tako.ChannelAuthScheme{HeaderName: "authorization"},
  Verify: func(input tako.VerifyInput) tako.ChannelAuthDecision {
    var params struct { RoomID string `json:"roomId"` }
    if json.Unmarshal(input.Params, &params) != nil {
      return tako.RejectChannel()
    }
    userID := authenticate(input.Header)
    if userID != "" && canJoinRoom(userID, params.RoomID) {
      return tako.AllowChannel(tako.ChannelGrant{Subject: userID})
    }
    return tako.RejectChannel()
  },
})

Place registration in application initialization before tako.ListenAndServe. authenticate and canJoinRoom are app-owned helpers. Validated roomId values select separate message streams and replay cursors; the verifier must check permission to use the requested room.

SSE clients subscribe to /_tako/channels/sse/chat?roomId=lobby. Setting Transport: tako.ChannelTransportWS enables WS instead: the JavaScript browser SDK then shares /_tako/channels/ws, carrying each topic and its params in subscription messages. connection: "dedicated" selects a separate socket at /_tako/channels/ws/chat?roomId=lobby. Go provides backend registration and auth, not the JavaScript browser handles or local publish/close methods; see network publication when publishing to a JavaScript-owned channel from Go.

Getting Started

mkdir my-app && cd my-app
tako init

Tako detects Go from go.mod, installs the tako.sh module, and scaffolds your project. Write your handlers, tako dev for local development with real HTTPS, tako deploy when you’re ready.

The full API is small on purpose — ListenAndServe, Listener, GetSecret, plus metadata and channel helpers. Check the docs for the complete reference, or browse the examples on GitHub to see Gin, Echo, Chi, and net/http in action.

Go is a language that values small interfaces and explicit control flow. We think tako.ListenAndServe(handler) fits right in.