mirror of
https://github.com/securego/gosec.git
synced 2025-03-01 12:43:28 +00:00
Add a flag to turn on scanning on vendor folder
This commit is contained in:
parent
f5b44b0740
commit
6919d97188
1 changed files with 6 additions and 2 deletions
|
@ -91,6 +91,8 @@ var (
|
||||||
// go build tags
|
// go build tags
|
||||||
flagBuildTags = flag.String("tags", "", "Comma separated list of build tags")
|
flagBuildTags = flag.String("tags", "", "Comma separated list of build tags")
|
||||||
|
|
||||||
|
flagScanVendor = flag.Bool("vendor", false, "Scan the vendor folder")
|
||||||
|
|
||||||
logger *log.Logger
|
logger *log.Logger
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -278,8 +280,10 @@ func main() {
|
||||||
for _, pkg := range gotool.ImportPaths(cleanPaths(flag.Args())) {
|
for _, pkg := range gotool.ImportPaths(cleanPaths(flag.Args())) {
|
||||||
|
|
||||||
// Skip vendor directory
|
// Skip vendor directory
|
||||||
if vendor.MatchString(pkg) {
|
if !*flagScanVendor {
|
||||||
continue
|
if vendor.MatchString(pkg) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
packages = append(packages, resolvePackage(pkg, gopaths))
|
packages = append(packages, resolvePackage(pkg, gopaths))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue