packagemain import( "fmt" "os" "bufio" ) funcmain(){ in:=make(chanstring) out:=make(chanstring) reader:=bufio.NewReader(os.Stdin) gofunc(){ for{ a:=<-in out<-a fmt.Println("in",a) } }() gofunc(){ for{ b:=<-out fmt.Println("out",b) } }() for{ line,_:=reader.ReadString('\n') fmt.Println("<----------------------------->") in<-line } }原文链接:https://www.f2er.com/go/190399.html