Original post

Hi, so I currently have two csv files which I want to read from, combine, and then put each combined row into a db. I’m thinking of sending each row into a channel and merge them once both channels have values to spit out. This is what I currently have in mind:

func collect(chanA chan(row), chanB chan(row)) {
    for {
            a, ok := <-chanA
            if !ok {
                    return
            }

            b := <-chanB

            combinedRow := combine(a,b)
        save(combinedRow)
    }
}

Is there a more elegant way to do this?