TIL: Streaming Data in Go with iter and yield A developer building RagPack, a Go library for chunking files for embedding, used the iter package introduced in Go 1.23 to create a streaming parser interface. The iter.Seq2 type allows parsers for various file formats (CSV, PDF, DOCX, etc.) to yield parsed units and errors one at a time, enabling a common ingestion loop that handles early termination efficiently. This design keeps memory usage flat for streaming formats and simplifies adding new parsers. While building RagPack https://github.com/eozsahin1993/ragpack , a library that chunks files for embedding, I needed a common way to stream parsed content from multiple file formats. RagPack supports CSV, PDF, DOCX, HTML, XLSX, Markdown, JSON and more. Each format has its own parser, but the ingester that consumes them should not care which one it is talking to. I needed a shared contract. In Java I would have reached for an Iterator