Skip to content

Concurrency

Targo concurrency comes from Go, not from JavaScript's async runtime.

Mental model

  • go(() => { ... }) starts goroutines
  • chan<T> moves data between goroutines
  • switch (chan.$select) coordinates multiple channel cases

Common migration shift

Do not ask:

  • what Promise does this return?
  • where do I await?

Instead ask:

  • does this need concurrency at all?
  • which channel carries the data?
  • how does failure flow?
  • who closes the channel?