mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 12:14:22 +01:00
Solved bug on error being overwritten and not passed to postAudit, closes #223
This commit is contained in:
1 parent
f4b9b6d0b3
commit
d6578df998
2 files changed
+11
-10
No files matched your search
@@ -2,14 +2,19 @@ package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/zricethezav/gitleaks/src"
|
||||
gitleaks "github.com/zricethezav/gitleaks/src"
|
||||
)
|
||||
|
||||
func main() {
|
||||
report, err := gitleaks.Run(gitleaks.ParseOpts())
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "whitelisted") {
|
||||
log.Info(err.Error())
|
||||
os.Exit(0)
|
||||
}
|
||||
log.Error(err)
|
||||
os.Exit(gitleaks.ErrExit)
|
||||
}
|
||||
|
||||
+5
-9
@@ -3,7 +3,6 @@ package gitleaks
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -60,7 +59,8 @@ func Run(optsL *Options) (*Report, error) {
|
||||
|
||||
// start audits
|
||||
if opts.Repo != "" || opts.RepoPath != "" {
|
||||
repoInfo, err := newRepoInfo()
|
||||
var repoInfo *RepoInfo
|
||||
repoInfo, err = newRepoInfo()
|
||||
if err != nil {
|
||||
goto postAudit
|
||||
}
|
||||
@@ -70,7 +70,8 @@ func Run(optsL *Options) (*Report, error) {
|
||||
}
|
||||
leaks, err = repoInfo.audit()
|
||||
} else if opts.OwnerPath != "" {
|
||||
repoDs, err := discoverRepos(opts.OwnerPath)
|
||||
var repoDs []*RepoInfo
|
||||
repoDs, err = discoverRepos(opts.OwnerPath)
|
||||
if err != nil {
|
||||
goto postAudit
|
||||
}
|
||||
@@ -96,12 +97,7 @@ func Run(optsL *Options) (*Report, error) {
|
||||
|
||||
postAudit:
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "whitelisted") {
|
||||
log.Info(err.Error())
|
||||
os.Exit(0)
|
||||
}
|
||||
log.Error(err)
|
||||
os.Exit(ErrExit)
|
||||
return &Report{}, err
|
||||
}
|
||||
|
||||
if opts.Report != "" {
|
||||
|
||||
Reference in new issue
Block a user