Standard library / io
io.ErrClosedPipe
Signals attempts to use a closed pipe unless the other end supplied a custom error. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
var ErrClosedPipe errorWorking Example
Example Snippetgo
package main
import ( "fmt" "io")
func main() { r, w := io.Pipe() r.Close() defer w.Close() _, e := w.Write([]byte("x")) fmt.Println(e == io.ErrClosedPipe)}