I’ve been writing Go since 2013. In that time, the language has remained remarkably stable. The few major shifts that did happen, however, fundamentally changed how I write code day-to-day:

  • context.Context
  • Structured error wrapping (fmt.Errorf, %w)
  • Go modules
  • Generics (I don’t introduce generic types daily, but I certainly consume them)

I knew Go 1.23 introduced iterators, but I didn’t pay much attention to them until recently. I was forced to adapt when a library I rely on began exposing iterators in its public API.

It took me a while to really "get" them, but I can now see how they are a powerful addition to the Go developer’s toolbox. If you’ve been avoiding iterators, here is a look at the helpful patterns that changed my mind.

The Basics: iter.Seq

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help