Skip to content

Commit 3ff0a2c

Browse files
authored
Fixes #644 (#645)
1 parent e3dffd6 commit 3ff0a2c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

cmd/gosec/main.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,13 @@ func getRootPaths(paths []string) []string {
208208
return rootPaths
209209
}
210210

211+
// If verbose is defined it overwrites the defined format
212+
// Otherwise the actual format is used
211213
func getPrintedFormat(format string, verbose string) string {
212-
fileFormat := format
213-
if format != "" && verbose != "" {
214-
fileFormat = verbose
214+
if verbose != "" {
215+
return verbose
215216
}
216-
return fileFormat
217+
return format
217218
}
218219

219220
func printReport(format string, color bool, rootPaths []string, reportInfo *gosec.ReportInfo) error {
@@ -384,7 +385,7 @@ func main() {
384385
reportInfo := gosec.NewReportInfo(issues, metrics, errors).WithVersion(Version)
385386

386387
if *flagOutput == "" || *flagStdOut {
387-
fileFormat := getPrintedFormat(*flagOutput, *flagVerbose)
388+
fileFormat := getPrintedFormat(*flagFormat, *flagVerbose)
388389
if err := printReport(fileFormat, *flagColor, rootPaths, reportInfo); err != nil {
389390
logger.Fatal((err))
390391
}

0 commit comments

Comments
 (0)