Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Commit

Permalink
don't print status of cloning message when scanning remote repository… (
Browse files Browse the repository at this point in the history
#50)

* don't print status of cloning message when scanning remote repository and outputting json or sarif

* highlight relevant finding lines; fix failed test (#46)
  • Loading branch information
praetorian-thendrickson authored Sep 20, 2021
1 parent a5aab4c commit bb678c0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion cmd/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ Scans a Go module directory. To scan the current directory recursively, use goka
}
defer util.CleanupModule(moduleTempDir)

err = util.CloneModule(moduleTempDir, remoteModule, remoteBranch, keyFile)
// Clone the module, if the output format is JSON or SARIF don't print any progress to stdout
err = util.CloneModule(moduleTempDir, remoteModule, remoteBranch, keyFile, json || sarif)

if err != nil {
util.CleanupModule(moduleTempDir)
Expand Down
12 changes: 8 additions & 4 deletions util/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@ import (

// CloneModule clones a remote git repository
// An optional keyfile may be specified for use in ssh authentication
func CloneModule(dir string, url string, branch string, keyFile string) error {
// If quiet is true, don't print clone progress to stdout
func CloneModule(dir string, url string, branch string, keyFile string, quiet bool) error {
var cloneOptions git.CloneOptions

log.Printf("Cloning new remote module: %s\n", url)
cloneOptions = git.CloneOptions{
URL: url,
Progress: os.Stdout,
URL: url,
}

if !quiet {
log.Printf("Cloning new remote module: %s\n", url)
cloneOptions.Progress = os.Stdout
}

if len(branch) != 0 {
Expand Down

0 comments on commit bb678c0

Please sign in to comment.