defer closing file (#1668)

Signed-off-by: razzle <harry@razzle.cloud>
This commit is contained in:
razzle
2023-03-15 14:50:42 -04:00
committed by GitHub
parent 302735097e
commit 1d9ef34ec7
+1
View File
@@ -385,6 +385,7 @@ func (s *Source) SetID() {
case FileScheme:
// attempt to use the digest of the contents of the file as the ID
file, err := os.Open(s.Metadata.Path)
defer file.Close()
if err != nil {
d = digest.FromString(s.Metadata.Path).String()
break