The community offers many packages that accomplish all kinds of tasks. We will take a quick look at some of these in this section.
Third-party packages
Virtual filesystems
Files are a struct in Go, a concrete type, and there's no abstraction around them, whereas a file's information is represented by os.FileInfo, which is an interface. This is slightly inconsistent, and there have been many attempts to create a full and consistent abstraction on the filesystem, commonly referred to as a virtual filesystem.
Two of the most used packages are as follows:
- vfs: github.com/blang/vfs
- afero: github.com/spf13/afero
Even if they are developed separately, they both do the same thing – they define an interface...