Close file handle when finished reading file
authorDavid Roda <droda@dramafever.com>
Wed, 17 Feb 2016 16:49:38 +0000 (11:49 -0500)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 17 Feb 2016 20:42:56 +0000 (21:42 +0100)
tpl/template_resources.go

index 204c0f39fa88ed79830235d6317e40e1918138a5..8f438155fbc4fdc627775d239c5e73f3321b022b 100644 (file)
@@ -88,7 +88,7 @@ func resGetCache(id string, fs afero.Fs, ignoreCache bool) ([]byte, error) {
        if err != nil {
                return nil, err
        }
-
+       defer f.Close()
        return ioutil.ReadAll(f)
 }
 
@@ -167,6 +167,7 @@ func resGetLocal(url string, fs afero.Fs) ([]byte, error) {
        if err != nil {
                return nil, err
        }
+       defer f.Close()
        return ioutil.ReadAll(f)
 }