Return exit code 1 when leaks are found

This commit is contained in:
Carlos Pereira committed 2019-07-31 23:21:30 +02:00
1 parent b2efcf36c8
commit 9e0e050f92
1 file changed
+7 -1
+7 -1
View File
@@ -9,7 +9,7 @@ import (
) )
func main() { func main() {
_, err := gitleaks.Run(gitleaks.ParseOpts()) leakCount, err := gitleaks.Run(gitleaks.ParseOpts())
if err != nil { if err != nil {
if strings.Contains(err.Error(), "whitelisted") { if strings.Contains(err.Error(), "whitelisted") {
log.Info(err.Error()) log.Info(err.Error())
@@ -18,4 +18,10 @@ func main() {
log.Error(err) log.Error(err)
os.Exit(gitleaks.ErrExit) os.Exit(gitleaks.ErrExit)
} }
if leakCount == 0 {
os.Exit(gitleaks.NoLeaks)
} else {
os.Exit(gitleaks.LeakExit)
}
} }