README

Go kit
Circle CI Travis CI builds.sr.ht status GoDoc Coverage Status Go Report Card Sourcegraph

Go kit is a programming toolkit for building microservices (or elegant monoliths) in Go. We solve common problems in distributed systems and application architecture so you can focus on delivering business value.

Sponsors

Click on Sponsor, above, for more information on sponsorship.

Motivation

Go has emerged as the language of the server, but it remains underrepresented in so-called "modern enterprise" companies like Facebook, Twitter, Netflix, and SoundCloud. Many of these organizations have turned to JVM-based stacks for their business logic, owing in large part to libraries and ecosystems that directly support their microservice architectures.

To reach its next level of success, Go needs more than simple primitives and idioms. It needs a comprehensive toolkit, for coherent distributed programming in the large. Go kit is a set of packages and best practices, which provide a comprehensive, robust, and trustable way of building microservices for organizations of any size.

For more details, see the website, the motivating blog post and the video of the talk. See also the Go kit talk at GopherCon 2015.

Goals

  • Operate in a heterogeneous SOA — expect to interact with mostly non-Go-kit services
  • RPC as the primary messaging pattern
  • Pluggable serialization and transport — not just JSON over HTTP
  • Operate within existing infrastructures — no mandates for specific tools or technologies

Non-goals

  • Supporting messaging patterns other than RPC (for now) — e.g. MPI, pub/sub, CQRS, etc.
  • Re-implementing functionality that can be provided by adapting existing software
  • Having opinions on operational concerns: deployment, configuration, process supervision, orchestration, etc.

Contributing

Please see CONTRIBUTING.md. Thank you, contributors!

Dependency management

Go kit is modules aware, and we encourage users to use the standard modules tooling. But Go kit is at major version 0, so it should be compatible with non-modules environments.

Projects with a ★ have had particular influence on Go kit's design (or vice-versa).

Service frameworks
  • gizmo, a microservice toolkit from The New York Times ★
  • go-micro, a microservices client/server library ★
  • gotalk, async peer communication protocol & library
  • Kite, a micro-service framework
  • gocircuit, dynamic cloud orchestration
Individual components
Web frameworks

Additional reading

Expand ▾ Collapse ▴

Directories

Path Synopsis
auth/basic
auth/casbin
auth/jwt
circuitbreaker Package circuitbreaker implements the circuit breaker pattern.
cmd/kitgen
cmd/kitgen/templates
endpoint Package endpoint defines an abstraction for RPCs.
examples/addsvc/cmd/addcli
examples/addsvc/cmd/addsvc
examples/addsvc/pb
examples/addsvc/pkg/addendpoint
examples/addsvc/pkg/addservice
examples/addsvc/pkg/addtransport
examples/addsvc/thrift/gen-go/addsvc
examples/addsvc/thrift/gen-go/addsvc/add_service-remote
examples/apigateway
examples/profilesvc
examples/profilesvc/client Package client provides a profilesvc client based on a predefined Consul service name and relevant tags.
examples/profilesvc/cmd/profilesvc
examples/shipping
examples/shipping/booking Package booking provides the use-case of booking a cargo.
examples/shipping/cargo Package cargo contains the heart of the domain model.
examples/shipping/handling Package handling provides the use-case for registering incidents.
examples/shipping/inmem Package inmem provides in-memory implementations of all the domain repositories.
examples/shipping/inspection Package inspection provides means to inspect cargos.
examples/shipping/location Package location provides the Location aggregate.
examples/shipping/routing Package routing provides the routing domain service.
examples/shipping/tracking Package tracking provides the use-case of tracking a cargo.
examples/shipping/voyage Package voyage provides the Voyage aggregate.
examples/stringsvc1
examples/stringsvc2
examples/stringsvc3
examples/stringsvc4
log Package log provides a structured logger.
log/deprecated_levels
log/level Package level implements leveled logging on top of Go kit's log package.
log/logrus Package logrus provides an adapter to the go-kit log.Logger interface.
log/syslog
log/term Package term provides tools for logging to a terminal.
log/zap
metrics Package metrics provides a framework for application instrumentation.
metrics/cloudwatch
metrics/cloudwatch2 Package cloudwatch2 emits all data as a StatisticsSet (rather than a singular Value) to CloudWatch via the aws-sdk-go-v2 SDK.
metrics/discard Package discard provides a no-op metrics backend.
metrics/dogstatsd Package dogstatsd provides a DogStatsD backend for package metrics.
metrics/expvar Package expvar provides expvar backends for metrics.
metrics/generic Package generic implements generic versions of each of the metric types.
metrics/graphite Package graphite provides a Graphite backend for metrics.
metrics/influx Package influx provides an InfluxDB implementation for metrics.
metrics/influxstatsd Package influxstatsd provides support for InfluxData's StatsD Telegraf plugin.
metrics/internal/convert Package convert provides a way to use Counters, Histograms, or Gauges as one of the other types
metrics/internal/lv
metrics/internal/ratemap Package ratemap implements a goroutine-safe map of string to float64.
metrics/multi Package multi provides adapters that send observations to multiple metrics simultaneously.
metrics/pcp
metrics/prometheus Package prometheus provides Prometheus implementations for metrics.
metrics/provider Package provider provides a factory-like abstraction for metrics backends.
metrics/statsd Package statsd provides a StatsD backend for package metrics.
metrics/teststat Package teststat provides helpers for testing metrics backends.
ratelimit
sd Package sd provides utilities related to service discovery.
sd/consul Package consul provides Instancer and Registrar implementations for Consul.
sd/dnssrv Package dnssrv provides an Instancer implementation for DNS SRV records.
sd/etcd Package etcd provides an Instancer and Registrar implementation for etcd.
sd/etcdv3 Package etcdv3 provides an Instancer and Registrar implementation for etcd v3.
sd/eureka Package eureka provides Instancer and Registrar implementations for Netflix OSS's Eureka
sd/internal/instance
sd/lb Package lb implements the client-side load balancer pattern.
sd/zk Package zk provides Instancer and Registrar implementations for ZooKeeper.
tracing Package tracing provides helpers and bindings for distributed tracing.
tracing/opencensus Package opencensus provides Go kit integration to the OpenCensus project.
tracing/opentracing Package opentracing provides Go kit integration to the OpenTracing project.
tracing/zipkin Package zipkin provides Go kit integration to the OpenZipkin project through the use of zipkin-go, the official OpenZipkin tracer implementation for Go.
transport Package transport contains helpers applicable to all supported transports.
transport/amqp Package amqp implements an AMQP transport.
transport/awslambda Package awslambda provides an AWS Lambda transport layer.
transport/grpc Package grpc provides a gRPC binding for endpoints.
transport/http Package http provides a general purpose HTTP binding for endpoints.
transport/http/jsonrpc Package jsonrpc provides a JSON RPC (v2.0) binding for endpoints.
transport/http/proto
transport/httprp Package httprp provides an HTTP reverse-proxy transport.
transport/nats Package nats provides a NATS transport.
util/conn Package conn provides utilities related to connections.