API Reference
Go kit
A toolkit for building microservices in Go, with transport, endpoint, and middleware abstractions.
Official Documentation ↗CompatibilityThis documentation covers version
v0.13. Check the official docs for the latest API surface.Installation
go
go get github.com/go-kit/kitMethods
No methods match this filter.
Go kit separates business logic into services and endpoints and adapts them to transports.
Key Features
- Endpoint abstraction of request and response
- HTTP, gRPC, and other transports
- Composable middleware for logging and metrics
Usage Notes
Pin a version and check the official docs for the API surface you depend on before upgrading.
Errors
The official API reference declares the following error types:
Failer(接口(响应类型可选实现,用于承载业务逻辑错误)) — official text: “Failer may be implemented by Go kit response types that contain business logic error details. If Failed returns a non-nil error, the Go kit transport layer may interpret this as a business logic error, and may encode it differently than a regular, successful r” (source: https://pkg.go.dev/github.com/go-kit/kit/endpoint, fetched 2026-11-08T19:32:00+08:00)
API reference evidence
Fetched from official sources on 2026-11-08T19:32:00+08:00 via WebFetch https://pkg.go.dev/github.com/go-kit/kit/endpoint;WebFetch https://pkg.go.dev/github.com/go-kit/kit/transport/http.
endpoint.Endpoint→ signature from https://pkg.go.dev/github.com/go-kit/kit/endpoint; official text: “type Endpoint func(ctx context.Context, request interface{}) (response interface{}, err error) Endpoint is the fundamental building block of servers and clients. It represents a single RPC method.”httptransport.NewServer→ signature from https://pkg.go.dev/github.com/go-kit/kit/transport/http; official text: “func NewServer(e endpoint.Endpoint, dec DecodeRequestFunc, enc EncodeResponseFunc, …) *Server”
FAQ
- Why the endpoint indirection?
- It decouples business logic from transports so the same method is callable over HTTP, gRPC, or in-process without duplication.
- How do I add metrics?
- Wrap the endpoint with instrumentation middleware and export to Prometheus or another backend from that layer.
- Is Go kit a framework?
- No. It is a set of libraries you compose yourself, giving control at the cost of more boilerplate.
Report a problem with this API docOpens a pre-filled issue on GitHub.