mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 05:24:22 +01:00
Code cleanup and badges
This commit is contained in:
1 parent
cf4c157141
commit
a9c5d5a953
6 files changed
+32
-31
No files matched your search
@@ -19,16 +19,16 @@ type LeakElem struct {
|
||||
Commit string `json:"commit"`
|
||||
}
|
||||
|
||||
func start(opts *Options, repoUrl string) {
|
||||
func start(_ *Options, repoURL string) {
|
||||
c := make(chan os.Signal, 2)
|
||||
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||
|
||||
err := exec.Command("git", "clone", repoUrl).Run()
|
||||
err := exec.Command("git", "clone", repoURL).Run()
|
||||
if err != nil {
|
||||
log.Fatalf("failed to clone repo %v", err)
|
||||
}
|
||||
repoName := getLocalRepoName(repoUrl)
|
||||
if err := os.Chdir(repoName); err != nil {
|
||||
repoName := getLocalRepoName(repoURL)
|
||||
if err = os.Chdir(repoName); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
go func() {
|
||||
@@ -39,8 +39,11 @@ func start(opts *Options, repoUrl string) {
|
||||
|
||||
report := getLeaks(repoName)
|
||||
cleanup(repoName)
|
||||
reportJson, _ := json.MarshalIndent(report, "", "\t")
|
||||
err = ioutil.WriteFile(fmt.Sprintf("%s_leaks.json", repoName), reportJson, 0644)
|
||||
reportJSON, _ := json.MarshalIndent(report, "", "\t")
|
||||
err = ioutil.WriteFile(fmt.Sprintf("%s_leaks.json", repoName), reportJSON, 0644)
|
||||
if err != nil {
|
||||
log.Fatalf("Can't write to file: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
// getLocalRepoName generates the name of the local clone folder based on the given URL
|
||||
|
||||
Reference in new issue
Block a user