GeistHaus
log in · sign up

iter

pkg.go.dev

Package iter provides basic definitions and operations related to iterators over sequences.

10 pages link to this URL
iter.json: A Powerful and Efficient Way to Iterate and Manipulate JSON in Go

Have you ever needed to modify unstructured JSON data in Go? Maybe you’ve had to delete password and all blacklisted fields, rename keys from camelCase to snake_case, or convert all number ids to strings because JavaScript does not like int64? If your solution has been to unmarshal everything into a map[string]any using encoding/json and then marshal it back… well, let’s face it, that’s far from efficient! What if you could loop through the JSON data, grab the path of each item, and decide exactly what to do with it on the fly?

0 inbound links article en w
Optimizing in-process gRPC with Go 1.23 Iterators and Coroutines

A few years back I have been exploring solutions for the in-process gRPC pattern in Go, for the Thanos project . Recently, a friend and a Thanos maintainer Filip refreshed the initial Thanos solution with the new Go 1.23 iterators . This created a perfect opportunity to share, in a co-authored blog post, what Filip and I learned about the new iterators, new coroutines (not goroutines!) and what options you have for the production in-process gRPC logic.

0 inbound links article en gogrpcefficiency
Iterators in GoLang

Iterators in GoLang were introduced in Go 1.23, and it was about time. Many programming languages like Python, Ruby, and JavaScript have iterators, which are powerful tools for iterating over collections. This post explores how to use iterators in GoLang, specifically demonstrating their use with the for loop and an example from Advent of Code 2024. Why to use an iterator Iterators provide a memory-efficient way to process sequences of data by generating values one at a time, only when needed.

0 inbound links article en posts