From b99fae8873e3c78a8fd53ba3154d3479aacd7421 Mon Sep 17 00:00:00 2001 From: Inanc Gumus Date: Mon, 4 Nov 2019 11:00:53 +0300 Subject: [PATCH] add: notes to io ifaces --- interfaces/13-io/main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/interfaces/13-io/main.go b/interfaces/13-io/main.go index 1cf2cd8..3f753c8 100644 --- a/interfaces/13-io/main.go +++ b/interfaces/13-io/main.go @@ -49,6 +49,8 @@ func main() { } } +// ioCopy streams from a file to another file. +// we use it to stream from the standard input to ouput. func ioCopy(dst, src *os.File) error { // Use a fixed-length buffer to efficiently read from src stream in chunks. buf := make([]byte, 32768) @@ -76,6 +78,7 @@ func ioCopy(dst, src *os.File) error { return nil } +// write method example. func write(dst *os.File, buf []byte) error { nw, ew := dst.Write(buf)