Notes on the Go translation of Reposurgeon (2020)
Regarding your point on iterators, I typically use a channel with context; this lets you exit that range loop early and will automatically stop the related go routine. (assuming it’s context aware)<p>e.g.<p>func myFunc(cx context.Context) {<p><pre><code>  ctx, cancel = context.WithCancel(cx)

  defer cancel()

  for item := range iterator(ctx) {
      
  }
}</code></pre>