Cette page est affichée en anglais. Une traduction française est en cours.
SkillsMay 3, 2026·3 min de lecture

Go-kit — Microservices Toolkit for Go

A curated set of packages and best practices for building robust, composable microservices in Go, covering transport, logging, metrics, and service discovery.

Prêt pour agents

Cet actif peut être lu et installé directement par les agents

TokRepo expose une commande CLI universelle, un contrat d'installation, le metadata JSON, un plan selon l'adaptateur et le contenu raw pour aider les agents à juger l'adaptation, le risque et les prochaines actions.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Go-kit Overview
Commande CLI universelle
npx tokrepo install 5553232a-46a7-11f1-9bc6-00163e2b0d79

Introduction

Go-kit is a programming toolkit for building microservices in Go. It addresses the common challenges of distributed systems—service discovery, load balancing, instrumentation, and transport—while letting developers focus on business logic. It promotes a layered architecture separating concerns cleanly.

What Go-kit Does

  • Provides composable abstractions for endpoints, transports, and middleware
  • Integrates service discovery via Consul, etcd, ZooKeeper, and DNS SRV
  • Supports multiple transports: HTTP, gRPC, Thrift, and NATS
  • Offers instrumentation adapters for Prometheus, StatsD, and OpenTelemetry
  • Includes circuit breakers, rate limiters, and request tracing out of the box

Architecture Overview

Go-kit separates every microservice into three layers: the Service (pure business logic as an interface), the Endpoint (a single RPC method wrapped with middleware like logging, circuit breaking, and rate limiting), and the Transport (encoding/decoding for HTTP, gRPC, or other protocols). This separation makes each concern independently testable and replaceable.

Self-Hosting & Configuration

  • Install with go get github.com/go-kit/kit in any Go module
  • Define your service interface and implement it in a struct
  • Wrap each method as an endpoint using endpoint.Endpoint type
  • Add middleware (logging, metrics) by chaining endpoint decorators
  • Choose a transport package and wire up server/client encode/decode functions

Key Features

  • Transport-agnostic design decouples business logic from communication protocol
  • First-class observability with structured logging and metrics adapters
  • Resilience patterns including circuit breakers (Hystrix, gobreaker) and rate limiters
  • Distributed tracing via OpenTracing and OpenTelemetry integrations
  • Mature ecosystem with production use at companies running large Go microservice fleets

Comparison with Similar Tools

  • Micro — full-fledged framework with runtime and plugins; Go-kit is a library, not a framework
  • gRPC (raw) — handles transport only; Go-kit adds logging, metrics, and service discovery on top
  • Kratos — opinionated Bilibili framework; Go-kit is unopinionated and composable
  • Go Zero — batteries-included with code generation; Go-kit favors explicit wiring
  • Dapr — sidecar-based runtime; Go-kit embeds capabilities directly in the Go process

FAQ

Q: Is Go-kit a framework or a library? A: It is a library. It provides building blocks you compose yourself rather than imposing project structure.

Q: Does Go-kit support gRPC? A: Yes. The transport/grpc package offers server and client helpers with full middleware support.

Q: Is Go-kit still maintained? A: The project is in maintenance mode with stable APIs. It remains widely used in production.

Q: Can I use Go-kit with an existing REST service? A: Yes. You can adopt Go-kit incrementally by wrapping individual endpoints without rewriting everything.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires