github.com/songzhibin97/gkit@v1.2.13/concurrent/pipeline.go (about) 1 package concurrent 2 3 // Pipeline 串联模式 4 func Pipeline(in chan interface{}) <-chan interface{} { 5 out := make(chan interface{}, 1) 6 go func() { 7 defer close(out) 8 for v := range in { 9 out <- v 10 } 11 }() 12 return out 13 }