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)