Reading and Writing Files with Slices

This lesson explains in detail how to use a slice for reading and writing to files.

Slices provide the standard-Go way to handle I/O buffers; they are used in the following second version of the function cat, which reads a file in an infinite for-loop (until end-of-file EOF) in a sliced buffer, and writes it to standard output.

Get hands-on with 1400+ tech skills courses.