finds.dev← search

// the find

segmentio/kafka-go

★ 8,573 · Go · MIT · updated Apr 2026

Kafka library in Go

A pure-Go Kafka client from Segment, built as a reaction to sarama's painful API and confluent-kafka-go's cgo dependency. Provides both a low-level Conn type and higher-level Reader/Writer abstractions that follow standard Go idioms. Aimed at teams who want something that feels like the Go standard library rather than a port of the Java client.

- The two-layer API is well-designed: low-level Conn for protocol work, high-level Reader/Writer for the 90% case. You can build on either without fighting the library.

- Native Go context support throughout — cancellation and timeouts work the way you expect, unlike sarama which bolted context on as an afterthought.

- Explicit commit mode (FetchMessage + CommitMessages) is a first-class pattern, not a workaround. You control exactly when offsets advance, which matters for at-least-once guarantees.

- Multiple balancer implementations (Hash, CRC32, Murmur2) with explicit compatibility notes for sarama, librdkafka, and the Java client — migration paths are actually documented.

- Tested only up to Kafka 2.7.1 per the README, despite Kafka being at 3.x for years. Newer protocol features (KRaft, incremental fetch improvements) are at best partially implemented.

- Consumer group support has a cluster of limitations baked in: SetOffset, Lag, and ReadLag all break or return -1 when GroupID is set. These aren't edge cases — they're things you'll want in production.

- WriterConfig and kafka.NewWriter are deprecated with no replacement timeline given. New users reading older blog posts will copy the deprecated pattern and not realize it until go vet or a future breaking release.

- The README notes that not calling Close() on Reader causes broker-side delays for reconnecting consumers, but the provided examples don't use signal.Notify. Anyone copy-pasting the quickstart will ship this bug.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →