github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/cmd/chore/gen-executables/derived.gen.go (about)

     1  // Code generated by goderive DO NOT EDIT.
     2  
     3  package main
     4  
     5  import (
     6  	executables "github.com/caos/orbos/internal/executables"
     7  )
     8  
     9  // deriveJoinPackables listens on all input channels c0 and c1, and sends all their results onto the single output channel.
    10  func deriveJoinPackables(c0 <-chan executables.PackableTuple, c1 <-chan executables.PackableTuple) <-chan executables.PackableTuple {
    11  	out := make(chan executables.PackableTuple)
    12  	go func() {
    13  		for c0 != nil || c1 != nil {
    14  			select {
    15  			case v0, ok0 := <-c0:
    16  				if !ok0 {
    17  					c0 = nil
    18  				} else {
    19  					out <- v0
    20  				}
    21  			case v1, ok1 := <-c1:
    22  				if !ok1 {
    23  					c1 = nil
    24  				} else {
    25  					out <- v1
    26  				}
    27  			}
    28  		}
    29  		close(out)
    30  	}()
    31  	return out
    32  }