April 2012
Intermediate to advanced
288 pages
4h 39m
English
If you’re going to write any nontrivial Go code, eventually you will get to the point where you need to interact with things outside of your program. The most common mechanism for persistent storage on modern systems is the filesystem, and it’s quite rare to see a program that doesn’t need to read files, even if it isn’t writing any.
If you want to write portable code, the filesystem is one of the more tricky areas that you have to deal with. Any modern operating system provides a file store, which is a mapping from filenames to sequences of bytes. Beyond that, the semantics can vary considerably.
1 package main 2 import "fmt" 3 import "path" 4 import ...
Read now
Unlock full access