I agree it looks unconventional and does not read well.
A more readable version would be
for i := range ChanOfInts(10, 20, 2)
for i := range OfInts(10, 20, 2)
but still, it looks ugly
overall I think the best solution is to use a classic for loop you cannot be more explicit than that and you do not sacrifice clarity at all. By the was the use of go-iter or iterators is even more ugly and un-necessary. In short KISS!
We’re a place for programmers to stay up-to-date, learn new skills, and share ideas.
We’ll never post without your permission.