Put a channel to a channel for golang

I have never heard this. I would like to use this from now.

package main

import "fmt"

type st struct {
    data1 int
    data2 int
}

func main() {
    c1 := make(chan *st, 1)
    c2 := make(chan *st, 1)
    c1 <- &st{1, 2}
    c2 <- <-c1
    close(c1)
    close(c2)
    res, _ := <-c2
    fmt.Println(res.data2)
}

>>> 2

 Share!