Iteration is the method of looking through a group of data, usually a list, in order to retrieve information from said list. Go has a bunch of different iterator patterns, all with benefits and drawbacks:
| Iterator | Benefit | Drawback |
| for loop | Simplest implementation | No default concurrency. |
| Iterator function with a callback | Simple implementation | Unconventional styling for Go; difficult to read. |
| Channels | Simple implementation | More expensive computationally than some other iterators (with a marginal cost difference). The only iterator that is naturally concurrent. |
| Stateful iterators | Difficult implementation | A nice caller interface. Useful for complex iterators (commonly used in the standard library). |
It's important to benchmark all of these against one another in order to validate assumptions about how long each one takes....