ワンクリックで
tako-sdk-go
tako.sh Go SDK: ListenAndServe for http.Handler, Listener for custom servers, typed secrets via tako generate, metadata helpers.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
tako.sh Go SDK: ListenAndServe for http.Handler, Listener for custom servers, typed secrets via tako generate, metadata helpers.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Tako CLI commands and project runtime workflow. Use when a repository contains tako.toml, imports tako.sh or tako.sh/vite, uses the Go or Rust SDK, or describes itself as a tako.sh app. Covers init, dev, deploy, secrets, storage, gen, scale, logs, rollback, servers, and doctor.
Tako CLI commands and project runtime workflow. Use when a repository contains tako.toml, imports tako.sh or tako.sh/vite, uses the Go or Rust SDK, or describes itself as a tako.sh app. Covers init, dev, deploy, secrets, storage, gen, scale, logs, rollback, servers, and doctor.
Tako CLI commands: init, dev, deploy, secrets, storage, gen, scale, logs, rollback, servers, doctor.
tako.sh SDK: fetch handler interface, tako runtime object, generated tako.d.ts type augmentation, defineChannel/defineWorkflow, Vite and Next.js adapters.
tako.sh SDK: fetch handler interface, tako runtime object, generated tako.d.ts type augmentation, defineChannel/defineWorkflow, Vite and Next.js adapters.
tako.sh SDK: fetch handler interface, tako runtime object, generated tako.d.ts type augmentation, defineChannel/defineWorkflow, Vite and Next.js adapters.
| name | tako-sdk-go |
| description | tako.sh Go SDK: ListenAndServe for http.Handler, Listener for custom servers, typed secrets via tako generate, metadata helpers. |
| type | framework |
| library | tako.sh |
| library_version | 0.0.1 |
| sources | ["tako-sh/tako:tako.go","tako-sh/tako:internal"] |
tako.sh Go module)Runtime SDK for Go apps deployed with Tako.
CRITICAL: The Go SDK is required — your app must call
tako.ListenAndServe()or usetako.Listener()to speak the Tako protocol (health checks, graceful shutdown). Secrets are loaded from the Tako bootstrap envelope at init time: fd 3 first for native processes, thenTAKO_BOOTSTRAP_DATAfor containers.
CRITICAL: Any framework that implements
http.Handlerworks directly withListenAndServe. Only Fiber (fasthttp) needs theListenerpath.
Tako wraps any standard http.Handler:
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)
}
This is a complete Tako app. ListenAndServe handles:
0.0.0.0:3000)Host: <app>.tako requests for health checks and channel authtako.ListenAndServe(handler http.Handler) errorWraps the handler with Tako protocol and starts serving. Blocks until shutdown.
Works with any http.Handler:
// net/http
mux := http.NewServeMux()
tako.ListenAndServe(mux)
// Gin
r := gin.Default()
tako.ListenAndServe(r)
// Echo
e := echo.New()
tako.ListenAndServe(e)
// Chi
r := chi.NewRouter()
tako.ListenAndServe(r)
tako.Listener() (net.Listener, error)Returns a net.Listener for frameworks that manage their own server:
// Fiber (fasthttp — does not implement http.Handler)
ln, err := tako.Listener()
if err != nil {
log.Fatal(err)
}
app := fiber.New()
app.Listener(ln)
Important: When using Listener() directly, your app must handle the Tako protocol itself (health checks on Host: <app>.tako, secrets endpoint). Most apps should use ListenAndServe instead.
tako.InstanceID() stringReturns the 8-char instance identifier assigned by tako-server. Empty in dev mode.
slog.Info("request handled", "instance", tako.InstanceID())
tako.Version() stringReturns the deploy version string. Empty in dev mode.
tako.Uptime() time.DurationReturns time since process start.
tako.GetSecret(name string) stringReturns a secret value by name. Prefer the generated Secrets struct instead of calling this directly.
Secrets are accessed via a generated struct — type-safe with autocompletion:
db := Secrets.DatabaseUrl()
key := Secrets.ApiKey()
Generate (or update) the typed secrets file:
tako generate
This reads secret names from .tako/secrets.json and generates tako_secrets.go:
// Code generated by tako generate. DO NOT EDIT.
package main
import "tako.sh"
var Secrets = struct {
ApiKey func() string
DatabaseUrl func() string
}{
ApiKey: func() string { return tako.GetSecret("API_KEY") },
DatabaseUrl: func() string { return tako.GetSecret("DATABASE_URL") },
}
Run tako generate after adding or removing secrets. tako gen and tako g are aliases.
The SDK transparently handles these — you don't interact with them directly:
GET /status on Host: <app>.tako — health check (returns JSON with status, instance_id, version, pid, uptime_seconds)POST /channels/authorize on Host: <app>.tako — channel auth callback for tako-serverx-tako-internal-token header (required in production, skipped in dev)TAKO_BOOTSTRAP_DATA.// WRONG — app won't respond to Tako protocol
http.ListenAndServe(":3000", mux)
// CORRECT — Tako handles health checks, graceful shutdown, bootstrap secrets
tako.ListenAndServe(mux)
// WRONG — Tako sets HOST/PORT for the instance
ln, _ := net.Listen("tcp", ":8080")
// CORRECT — let Tako choose the address
tako.ListenAndServe(mux)
// or
ln, _ := tako.Listener()
// WRONG — Listener alone doesn't add health checks
ln, _ := tako.Listener()
http.Serve(ln, mux)
// CORRECT — use ListenAndServe (adds protocol wrapping)
tako.ListenAndServe(mux)
// or if you need Listener (Fiber), the framework must handle
// Host: <app>.tako requests itself — this is an advanced path