在两个golang通道之间实现隧道

I am trying to implement a tunnel between two go channels (note I am very new to go). My goroutine looks like this:

consumer := ...
producer := ...
go func() {
    for jsn := range producer {
        msg, err := ops.FromJSON(jsn)
        if err != nil {
            log.Print(err)
            continue
        }
        consumer <- msg
    }
}()

This though seems to have some issues. How can I check if the consumer is already closed? How to solve the race between getting the message from the producer and sending it to the consumer? ... and maybe others.

Can someone provide a good example of a tunnel between two channels?