etcd — Dependencies#

Module info#

  • Module: go.etcd.io/etcd/v3 (root workspace module)
  • Go version: 1.26 (toolchain go1.26.1 — cutting-edge)
  • Direct dependencies (root go.mod): 21 (includes internal sibling modules)
  • Indirect dependencies (root go.sum entries): 214 lines (~107 unique modules, each appears twice)
  • Workspace structure: 13 modules in a Go workspace; each has its own go.mod with independent dependency sets

Note on counting: Because etcd is a multi-module workspace, the meaningful dependency count is per-module. The root go.mod is a convenience aggregation. The heaviest module is server/ with ~35 direct dependencies.

Dependency categories#

Core infrastructure#

PackageVersionUsed inPurpose
go.uber.org/zapv1.27.1all modulesStructured logging. Most-used third-party package in the codebase (121 import occurrences in server/ alone). Chosen over stdlib log for performance and structured fields in high-throughput scenarios.
github.com/spf13/cobrav1.10.2server, etcdctl, pkgCLI framework for etcd server flags and etcdctl/etcdutl commands.
github.com/spf13/pflagv1.0.10etcdctl, pkgPOSIX/GNU flag parsing (cobra dependency and used directly).
github.com/coreos/go-semverv0.3.1server, client, apiSemantic version parsing for cluster version negotiation and compatibility checks.
github.com/dustin/go-humanizev1.0.1server, etcdctlHuman-readable numbers/sizes in output.
gopkg.in/natefinch/lumberjack.v2v2.2.1serverLog rotation for the WAL and server logs.
go.etcd.io/gofailv0.2.0server (indirect)Fault injection framework for testing failure scenarios — a etcd-maintained tool for chaos testing.

Networking / RPC#

PackageVersionUsed inPurpose
google.golang.org/grpcv1.79.3server, client/v3, api, etcdctlCore transport layer. The entire etcd API is gRPC-first.
google.golang.org/protobufv1.36.11server, apiProtobuf message serialization for wire format.
github.com/golang/protobufv1.5.4server, apiLegacy protobuf API bridge (kept for gogo/protobuf compatibility).
github.com/gogo/protobufv1.3.2serverHigh-performance protobuf used inside the Raft log encoding (performance-critical path).
github.com/grpc-ecosystem/grpc-gateway/v2v2.28.0server, apiTranslates REST/HTTP+JSON calls into gRPC, providing the v3 HTTP API.
github.com/grpc-ecosystem/go-grpc-middleware/v2v2.3.3server, clientgRPC interceptor chains for auth, logging, retry, and timeout.
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheusv1.1.0server, clientPrometheus metrics for gRPC calls.
github.com/soheilhy/cmuxv0.1.5serverConnection multiplexer — lets etcd serve gRPC and HTTP on the same port.
github.com/tmc/grpc-websocket-proxyv0.0.0-…`serverProxies gRPC-gateway to WebSocket clients (for browser watch streams).
github.com/gorilla/websocketv1.5.0server (indirect)WebSocket support (pulled in by grpc-websocket-proxy).
github.com/xiang90/probingv0.0.0-…`serverHealth-probe utility for peer-to-peer membership probing in cluster liveness detection.
github.com/coreos/go-systemd/v22v22.7.0server, client/pkgsystemd socket activation and journald logging integration.

Data / Storage#

PackageVersionUsed inPurpose
go.etcd.io/bboltv1.4.3serverBoltDB — the embedded B-tree storage engine for all persistent data. The only storage backend; there is no pluggable storage interface.
go.etcd.io/raft/v3v3.6.0-beta.0serverThe extracted Raft consensus library. Etcd owns this repo but it is versioned independently. The server imports raft/v3/raftpb (54 times) and raft/v3 (22 times).
github.com/google/uuidv1.6.0server (indirect)UUID generation, likely for member IDs and cluster IDs.
sigs.k8s.io/yamlv1.6.0server, clientYAML parsing for config files and watch event serialization. Chosen over gopkg.in/yaml.v3 for Kubernetes ecosystem compatibility.
k8s.io/utilsv0.0.0-…server, cacheKubernetes utility functions — used in the new client-side cache module. Reflects Kubernetes as the primary consumer.

Observability#

PackageVersionUsed inPurpose
github.com/prometheus/client_golangv1.23.2server, clientPrometheus metrics exposition. Server exposes /metrics endpoint.
github.com/prometheus/client_modelv0.6.2server (indirect)Prometheus data model.
go.opentelemetry.io/otelv1.42.0server, pkgOpenTelemetry tracing core.
go.opentelemetry.io/otel/sdkv1.42.0serverOTel SDK for trace export.
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpcv1.42.0serverOTLP gRPC trace exporter.
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpcv0.65.0serverOTel gRPC interceptors for distributed tracing.
github.com/jonboulle/clockworkv0.5.0serverMockable clock abstraction used in tests and timeouts.

Security#

PackageVersionUsed inPurpose
github.com/golang-jwt/jwt/v5v5.3.1serverJWT token signing and verification for the RBAC authentication system.

CLI / Terminal#

PackageVersionUsed inPurpose
github.com/bgentry/speakeasyv0.2.0root, etcdctlSecure password prompt (hides typing for auth password input).
github.com/cheggaaa/pb/v3v3.1.7root, etcdctlProgress bar for snapshot operations.
github.com/olekukonko/tablewriterv1.1.4etcdctlFormatted table output for etcdctl commands.
github.com/fatih/colorv1.19.0etcdctl (indirect)Terminal color output.

Testing#

PackageVersionUsed inPurpose
github.com/stretchr/testifyv1.11.1all modulesAssertion library. Used heavily — assert and require packages appear 43 and 35 times respectively in server/ imports.
github.com/google/go-cmpv0.7.0server, cacheDeep equality comparison for tests. Used alongside testify.
go.uber.org/zap/zaptestserverZap test logger (65 import occurrences in server tests).
github.com/sirupsen/logrusv1.9.4server (indirect)Pulled in transitively (via grpc-gateway or websocket-proxy). Not used directly by etcd code.
github.com/kylelemons/godebugv1.1.0server (indirect)Diff utility used in some test assertions.

Stdlib reliance#

etcd makes heavy use of the Go standard library. In the server/ module:

  • context (101 files): Ubiquitous for cancellation and deadline propagation across gRPC calls and background goroutines.
  • time (130 files): Critical for election timeouts, heartbeat intervals, lease TTLs, and session management.
  • sync (67 files): Mutex, RWMutex, WaitGroup, Once throughout the server for concurrent state management.
  • fmt / errors: Standard error construction; etcd avoids pkg/errors and instead uses stdlib errors + fmt.Errorf %w.
  • net/http (45 files): Direct HTTP handler for metrics, health checks, and gRPC-gateway.
  • io / bytes: WAL encoding/decoding and snapshot streaming.
  • encoding/json (28 files): Serialization for config, watch events, and cluster info.
  • path / os: File system access for WAL and snapshot storage.

The project achieves a healthy balance: stdlib handles concurrency, errors, and I/O; third-party handles logging (zap), RPC (grpc/protobuf), and storage (bbolt).

Shared dependencies#

These dependencies are widely used across Go projects and create natural book connection points:

DependencySignificance
go.uber.org/zapIndustry-standard structured logger; used in dozens of major Go projects (Kubernetes, Jaeger, etc.)
google.golang.org/grpcStandard gRPC transport; connects etcd to any gRPC-using project
github.com/spf13/cobraUbiquitous CLI framework (~50% of major Go CLIs)
github.com/prometheus/client_golangStandard metrics library for the CNCF ecosystem
github.com/stretchr/testifyMost popular Go test assertion library
sigs.k8s.io/yamlSignals Kubernetes-ecosystem alignment
go.opentelemetry.io/otelSignals adoption of OTel as the observability standard

Vendoring#

No vendor directory. etcd uses the module proxy and go.sum checksums for reproducibility. This is the modern approach for projects with strong CI infrastructure; the go.sum file with 214 entries provides integrity guarantees without the disk bloat of vendoring.

Notable dependency decisions#

  1. Two protobuf libraries in parallel: etcd imports both google.golang.org/protobuf (modern) and github.com/gogo/protobuf (high-performance). The gogo variant is used for Raft log entries where serialization is on the critical path; the Google variant is used for the API layer. This pragmatic split prioritizes performance in the hot path.

  2. Raft as an external module (go.etcd.io/raft/v3): The consensus algorithm — etcd’s most distinctive component — is versioned independently from the server. This enables other projects to embed Raft without taking a dependency on the etcd server. The import count (raftpb 54 times, raft/v3 22 times) shows deep integration.

  3. bbolt as the sole storage backend: Unlike databases that abstract over multiple storage engines, etcd commits entirely to bbolt (the maintained fork of BoltDB). The MVCC layer is built on top of bbolt’s B-tree, not behind a pluggable interface. This simplicity-over-flexibility choice reflects etcd’s correctness-first philosophy.

  4. OpenTelemetry stack (not Jaeger directly): etcd uses OTel’s vendor-neutral API for tracing, exporting via OTLP. This is a deliberate ecosystem alignment choice — consumers can route traces to any backend without modifying etcd.

  5. k8s.io/utils in the cache module: The presence of a Kubernetes utility package in the new client-side cache module directly acknowledges Kubernetes as the primary consumer. This is unusual: most libraries avoid dependencies on their own consumers.

  6. go.etcd.io/gofail: etcd maintains its own fault-injection library and uses it in server code. This is a sophisticated testing dependency that enables controlled failure injection in production code paths, underscoring the project’s commitment to robustness testing.

  7. Minimal client dependency surface: The client/v3 module has only 9 direct external dependencies (zap, testify, grpc, protobuf, semver, humanize, prometheus, grpc-middleware). This disciplined surface means embedding the etcd client in a Go application adds a manageable transitive dependency tree.