The rangefunc experimental feature is now available with Go 1.22.
Over the last couple of weeks I have been playing with this new feature to see how far I can push it, and I think it may just change the way we write some loops in Go.
Sign up for my Golang course at: https://dreamsofcode.io/courses/command-line-apps-go
(Website is written in Go, btw)
Video links:
- RangeFunc wiki: https://go.dev/wiki/RangefuncExperiment
- Loop package: https://github.com/dreamsofcode-io/loop
Join this channel to get access to perks:
https://www.youtube.com/channel/UCWQaM7SpSECp9FELz-cHzuQ/join
Join Discord: https://discord.com/invite/eMjRTvscyt
Join Twitter: https://twitter.com/dreamsofcode_io
00:00:00 Intro
00:00:23 rangefunc
00:01:55 Parallel iteration in Go
00:03:46 Convert to Parallel Iterator
00:05:57 Handling Break
00:07:47 Making Generic
00:08:28 Footguns
00:09:08 iter package
00:10:01 Loop package
00:10:38 Conclusion
00:10:59 Good news!