Skip to content

Commit

Permalink
fix(gosec): don't defer file Close()
Browse files Browse the repository at this point in the history
  • Loading branch information
amine7536 committed Nov 10, 2021
1 parent e66a1d1 commit 219ca50
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/wrapper/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ func isEmptyDirOrNotExist(name string) (found bool, err error) {
}
return false, err
}
defer func() {
err = f.Close()
}()

if err = f.Close(); err != nil {
return true, err
}

_, err = f.Readdirnames(1) // Or f.Readdir(1)
if err == io.EOF {
Expand Down

0 comments on commit 219ca50

Please sign in to comment.