Use the Afero source fs where relevant

Fixes #2319
This commit is contained in:
Bjørn Erik Pedersen
2016-07-30 15:37:03 +02:00
parent a0859dc672
commit 4ddd5361c1
4 changed files with 13 additions and 34 deletions

View File

@@ -83,12 +83,8 @@ func resGetCache(id string, fs afero.Fs, ignoreCache bool) ([]byte, error) {
return nil, nil
}
f, err := fs.Open(fID)
if err != nil {
return nil, err
}
defer f.Close()
return ioutil.ReadAll(f)
return afero.ReadFile(fs, fID)
}
// resWriteCache writes bytes to an ID into the file cache
@@ -165,12 +161,8 @@ func resGetLocal(url string, fs afero.Fs) ([]byte, error) {
return nil, err
}
f, err := fs.Open(filename)
if err != nil {
return nil, err
}
defer f.Close()
return ioutil.ReadAll(f)
return afero.ReadFile(fs, filename)
}
// resGetResource loads the content of a local or remote file