Golang afero
From wikinotes
Afero defines and implements an interface to access the filesystem.
You can then pass in an abstraction of real os calls, or a stub stub interface you can make assertions against.
Documentation
github https://github.com/spf13/afero
Usage
Basics
appfs := afero.NewOsFs() // real 'os' calls appfs := afero.NewMemMapFs() // memory backed fake filesystem // there are several additional options, like sftp, CopyOnWriteFs, ... appfs.Create("/var/tmp/foo.txt') // either creates on disk, or in memoryThere are no assertions, when testing use the API to check the presence/contents of the file.