main.go 508 B

12345678910111213141516171819202122
  1. package main
  2. import (
  3. "os"
  4. log "github.com/sirupsen/logrus"
  5. "github.com/zricethezav/gitleaks/src"
  6. )
  7. func main() {
  8. report, err := gitleaks.Run(gitleaks.ParseOpts())
  9. if err != nil {
  10. log.Fatal(err)
  11. }
  12. if len(report.Leaks) != 0 {
  13. log.Warnf("%d leaks detected. %d commits inspected in %s", len(report.Leaks), report.Commits, report.Duration)
  14. os.Exit(gitleaks.LeakExit)
  15. } else {
  16. log.Infof("%d leaks detected. %d commits inspected in %s", len(report.Leaks), report.Commits, report.Duration)
  17. }
  18. }