Standard library / io

io.PipeWriter

Write end of Pipe; writes wait for consumption, and Close signals EOF to readers. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
type PipeWriter struct { /* unexported fields */ }

Working Example

Example Snippetgo
package main
import (  "fmt"  "io")
func main() {  r, w := io.Pipe()  defer r.Close()  var pw *io.PipeWriter = w  pw.Close()  _, e := r.Read(make([]byte, 1))  fmt.Println(e == io.EOF)}
Go Reference