Thinking about the kind of test we want to see

Let's remind ourselves of our mindset and goals when starting:

Write the test we want to see. Think about how we'd like to use the code we're going to write from a consumer's point of view.

Focus on what and why, but don't get distracted by how.

what is a file system FS?

a file system is a hierarchal a data structure, it is a software layer that lies between os and hard disk, it manages the files and it is accessed by os to read and write files and dir, an File system can be as simple are a single file or it can also me something complex as many dir and subdir and with many files

we use fs instead of os to handle the files because it decouples our code from the os specific things like how the file location is represented etc

os/fs :

when we use os/fs we are not entirely by passing the os and interact directly with the fs but os/fs package still relies on the os specific things and access the files through the os

User Application --> Go io/fs Package --> OS Filesystem Driver --> Storage Device

some useful methods from fs:

func ReadDir(fsys [FS](<https://pkg.go.dev/io/fs#FS>), name [string](<https://pkg.go.dev/builtin#string>)) ([][DirEntry](<https://pkg.go.dev/io/fs#DirEntry>), [error](<https://pkg.go.dev/builtin#error>))

ReadDir reads the named directory and returns a list of directory entries sorted by filename.

DirEntry:

A DirEntry is an entry read from a directory (using the ReadDir function or a ReadDirFile's ReadDir method).

FS.Open(name [string](<https://pkg.go.dev/builtin#string>)) ([File](<https://pkg.go.dev/io/fs#File>), [error](<https://pkg.go.dev/builtin#error>))

opens the named file and return the file and error