-
Book Overview & Buying
-
Table Of Contents
Practical Systems Programming in Go
By :
We began this chapter by showing how to handle UNIX signals in Go. Then, we explored Go's capabilities for working with the filesystem in depth. We started with the basics of retrieving file information before moving on to traversing directory trees and gathering useful statistics about files and directories. We learned how to differentiate between file types, locate empty directories, and even embed static assets directly into Go binaries using the embed package. Along the way, we saw how the io/fs package provides a consistent abstraction for handling file and directory data, with tools such as fs.WalkDir() simplifying traversal. We also built practical utilities such as file statistics collectors, empty directory finders, a utility that copies a single file into multiple directories, and simplified tree(1) and dd(1) clones, demonstrating how Go code can replicate UNIX commands.
In the next chapter, we will move from unstructured bytes and directory hierarchies to the world...