===============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 */
时间: 2024-10-09 20:26:32