// +build OMITpackagemainimport"fmt"// gen sends the values in nums on the returned channel, then closes it.funcgen(nums...int)<-chanint{out:=make(chanint)gofunc(){for_,n:=rangenums{out<-n}close(out)}()returnout}// sq receives values from in, squares them, and sends them on the returned// channel, until in is closed. Then sq closes the returned channel.funcsq(in<-chanint)<-chanint{out:=make(chanint)gofunc(){forn:=rangein{out<-n*n}close(out)}()returnout}funcmain(){// Set up the pipeline.c:=gen(2,3)out:=sq(c)// Consume the output.fmt.Println(<-out)// 4fmt.Println(<-out)// 9}