add: notes to io ifaces

This commit is contained in:
Inanc Gumus
2019-11-04 11:00:53 +03:00
parent ead2341124
commit b99fae8873

View File

@ -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)