Merge pull request #29926 from simaotwx/patch-1
funcs: defer close file in filesha256
This commit is contained in:
commit
db9109d2ce
|
@ -248,6 +248,7 @@ func makeFileHashFunction(baseDir string, hf func() hash.Hash, enc func([]byte)
|
|||
if err != nil {
|
||||
return cty.UnknownVal(cty.String), err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
h := hf()
|
||||
_, err = io.Copy(h, f)
|
||||
|
|
|
@ -377,6 +377,7 @@ func readFileBytes(baseDir, path string) ([]byte, error) {
|
|||
}
|
||||
return nil, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
src, err := ioutil.ReadAll(f)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue