From 6919d97188ea0b4b7466d34a02d9c5e76500c334 Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Mon, 30 Jul 2018 09:11:23 +0200 Subject: [PATCH] Add a flag to turn on scanning on vendor folder --- cmd/gosec/main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/gosec/main.go b/cmd/gosec/main.go index f6c3724..df96840 100644 --- a/cmd/gosec/main.go +++ b/cmd/gosec/main.go @@ -91,6 +91,8 @@ var ( // go build tags flagBuildTags = flag.String("tags", "", "Comma separated list of build tags") + flagScanVendor = flag.Bool("vendor", false, "Scan the vendor folder") + logger *log.Logger ) @@ -278,8 +280,10 @@ func main() { for _, pkg := range gotool.ImportPaths(cleanPaths(flag.Args())) { // Skip vendor directory - if vendor.MatchString(pkg) { - continue + if !*flagScanVendor { + if vendor.MatchString(pkg) { + continue + } } packages = append(packages, resolvePackage(pkg, gopaths)) }