var filesources … // AddFileSource registers another provider for files that may be // needed at runtime. Should be called during initialization of a test // binary. func AddFileSource(filesource FileSource) { … } type FileSource … // Read tries to retrieve the desired file content from // one of the registered file sources. func Read(filePath string) ([]byte, error) { … } // Exists checks whether a file could be read. Unexpected errors // are handled by calling the fail function, which then should // abort the current test. func Exists(filePath string) (bool, error) { … } type RootFileSource … // ReadTestFile looks for the file relative to the configured // root directory. If the path is already absolute, for example // in a test that has its own method of determining where // files are, then the path will be used directly. func (r RootFileSource) ReadTestFile(filePath string) ([]byte, error) { … } // DescribeFiles explains that it looks for files inside a certain // root directory. func (r RootFileSource) DescribeFiles() string { … } type EmbeddedFileSource … // ReadTestFile looks for an embedded file with the given path. func (e EmbeddedFileSource) ReadTestFile(filepath string) ([]byte, error) { … } // DescribeFiles explains that it is looking inside an embedded filesystem func (e EmbeddedFileSource) DescribeFiles() string { … } func (e *EmbeddedFileSource) populateFileList() { … }