===============golang pipe============== package main import ( "fmt" "io" ) func main() { reader, writer := io.Pipe() inputData := []byte("1234567890ABCD") go writer.Write(inputData) outputData := make([]byte, 11) n, _ := reader.Read(outputData) fmt.Println(string(outputData)) fmt.Println("read number", n) fmt.Println(string(outputData)) } /* 1234567890A read number 11 1234567890A */
原文:http://www.cnblogs.com/rojas/p/4396031.html