mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 12:44:22 +01:00
nosec gosec (#490)
This commit is contained in:
1 parent
f036dce6ab
commit
091ea81e68
4 files changed
+24
-7
No files matched your search
+8
-1
@@ -178,7 +178,7 @@ func optsToCommits(opts options.Options) ([]string, error) {
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
defer file.Close()
|
||||
defer rable(file.Close)
|
||||
|
||||
scanner := bufio.NewScanner(file)
|
||||
var commits []string
|
||||
@@ -218,3 +218,10 @@ func extractLine(patchContent string, leak Leak, lineLookup map[string]bool) int
|
||||
}
|
||||
return defaultLineNumber
|
||||
}
|
||||
|
||||
// rable is the second half of deferrable... mainly used for defer file.Close()
|
||||
func rable(f func() error) {
|
||||
if err := f(); err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user