Standard library / io
io.PipeReader
Read end of synchronous in-memory Pipe; Close unblocks the writer. Create with Pipe rather than zero value. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
type PipeReader struct { /* unexported fields */ }Working Example
Example Snippetgo
package main
import ( "fmt" "io")
func main() { r, w := io.Pipe() var pr *io.PipeReader = r w.Close() defer pr.Close() _, e := pr.Read(make([]byte, 1)) fmt.Println(e == io.EOF)}