Fan-In
Hard · Concurrency
Fan-in merges values from several channels into one. Start a goroutine per input that forwards values, close the output after every input is drained (sync.WaitGroup), and never send on a closed channel.
Write FanIn(inputs) that returns a receive-only channel of all values. RunFanIn(groups) is already written: it builds a channel per group, calls FanIn, and returns the values sorted (order across inputs is not guaranteed).
Next: Worker Pool