main.go 536 B

1234567891011121314151617181920212223
  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.Error(err)
  11. os.Exit(gitleaks.ErrExit)
  12. }
  13. if len(report.Leaks) != 0 {
  14. log.Warnf("%d leaks detected. %d commits inspected in %s", len(report.Leaks), report.Commits, report.Duration)
  15. os.Exit(gitleaks.LeakExit)
  16. } else {
  17. log.Infof("%d leaks detected. %d commits inspected in %s", len(report.Leaks), report.Commits, report.Duration)
  18. }
  19. }