标签:
package main import( "fmt" "os" "bufio" ) func main(){ in :=make(chan string) out :=make(chan string) reader := bufio.NewReader(os.Stdin) go func(){ for { a:= <-in out <- a fmt.Println("in",a) } }() go func(){ for { b:=<-out fmt.Println("out",b) } }() for{ line, _:= reader.ReadString(‘\n‘) fmt.Println("<----------------------------->") in <- line } }
标签:
原文地址:http://my.oschina.net/u/1388024/blog/417741