Skip to content

Instantly share code, notes, and snippets.

View otakijae's full-sized avatar
🦈

otakijae otakijae

🦈
View GitHub Profile
@otakijae
otakijae / example.go
Created April 29, 2020 04:20
[Golang] io.Pipe
// Pipe creates a synchronous in-memory pipe.
// It can be used to connect code expecting an io.Reader
// with code expecting an io.Writer.
// Reads on one end are matched with writes on the other,
// copying data directly between the two; there is no internal buffering.
// It is safe to call Read and Write in parallel with each other or with
// Close. Close will complete once pending I/O is done. Parallel calls to
// Read, and parallel calls to Write, are also safe:
// the individual calls will be gated sequentially.