Explorar o código

Merge pull request #244 from cfzlp/non-zero-exit-for-leaks

Return exit code 1 when leaks are found
Zachary Rice %!s(int64=6) %!d(string=hai) anos
pai
achega
04e81270cb
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      main.go

+ 7 - 1
main.go

@@ -9,7 +9,7 @@ import (
 )
 
 func main() {
-	_, err := gitleaks.Run(gitleaks.ParseOpts())
+	leakCount, err := gitleaks.Run(gitleaks.ParseOpts())
 	if err != nil {
 		if strings.Contains(err.Error(), "whitelisted") {
 			log.Info(err.Error())
@@ -18,4 +18,10 @@ func main() {
 		log.Error(err)
 		os.Exit(gitleaks.ErrExit)
 	}
+
+	if leakCount == 0 {
+		os.Exit(gitleaks.NoLeaks)
+	} else {
+		os.Exit(gitleaks.LeakExit)
+	}
 }