From 04ce7baf6c558fc7e694f72e4c38bb4906875e2e Mon Sep 17 00:00:00 2001 From: JulesDT Date: Fri, 25 Jan 2019 12:04:43 -0500 Subject: [PATCH] add a no-fail flag --- cmd/gosec/main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/gosec/main.go b/cmd/gosec/main.go index 1ec64d9..bab1e93 100644 --- a/cmd/gosec/main.go +++ b/cmd/gosec/main.go @@ -97,6 +97,9 @@ var ( // fail by severity flagSeverity = flag.String("severity", "low", "Fail the scanning for issues with the given or higher severity. Valid options are: low, medium, high") + // do not fail + flagNoFail = flag.Bool("no-fail", false, "Do not fail the scanning, even if issues were found") + logger *log.Logger ) @@ -348,8 +351,8 @@ func main() { // Finalize logging logWriter.Close() // #nosec - // Do we have an issue? If so exit 1 - if issuesFound { + // Do we have an issue? If so exit 1 unless NoFail is set + if issuesFound && !*flagNoFail { os.Exit(1) } }