title: Which type of UML diagram is suited for depicting goroutines collaborating via channel?
body: <p>Let's assume there is a simple integer calculator that only supports addition and multiplication operation. It will receive an integer generator and an integer as additive or multiplier as its input parameters and apply the corresponding calculation for each element that comes from the generator.</p>
  <p>I think the following rough sequence diagram depicts this logic appropriately.
  <a href="https://i.stack.imgur.com/yKOam.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yKOam.png" alt="a rough sequence diagram" /></a></p>
  <p>But when I use goroutines and channels to implement the same logic, the straight method/function calling relationship disappeared because goroutines utilize channels to send and receive data.</p>
  <pre class="lang-golang prettyprint-override"><code>generator := func(integers ...int) &lt;-chan int {
      intStream := make(chan int)
      go func() {
          defer close(intStream)
          for _, i := range integers {
              intStream &lt;- i
          }
      }()
      return intStream
  }
  
  multiply := func(intStream &lt;-chan int, multiplier int) &lt;-chan int {
      multipliedStream := make(chan int)
      go func() {
          defer close(multipliedStream)
          for i := range intStream {
              multipliedStream &lt;- i*multiplier
          }
      }()
      return multipliedStream
  }
  
  
  add := func(intStream &lt;-chan int, additive int) &lt;-chan int {
      addedStream := make(chan int)
      go func() {
          defer close(addedStream)
          for i := range intStream {
              addedStream &lt;- i+additive
          }
      }()
      return addedStream
  }
  
  intStream := generator(1, 2, 3, 4)
  pipeline := multiply(add(intStream, 1), 2)
  
  for v := range pipeline {
      fmt.Println(v)
  }
  </code></pre>
  <p>The goroutine born in the <code>generator</code> acts as a producer to send integers; the goroutines born in the <code>add</code> and <code>multiply</code> are both producers and consumers; they receive integers, handle them, and put them into new channels. Finally, two channels connect these 3 goroutines as a pipeline, but I have no idea to present it to be clear at a glance.</p>
  <p>Is there a kind of goroutines-oriented UML diagram?</p>