Skip to content

Commit

Permalink
defer closing file (#1668)
Browse files Browse the repository at this point in the history
Signed-off-by: razzle <harry@razzle.cloud>
  • Loading branch information
Noxsios committed Mar 15, 2023
1 parent 3027350 commit 1d9ef34
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions syft/source/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1d9ef34

Please sign in to comment.