mirror of
https://github.com/securego/gosec.git
synced 2024-12-26 12:35:52 +00:00
Merge pull request #222 from ccojocar/vendor_folder_flag
Add a flag to turn on scanning on vendor folder
This commit is contained in:
commit
c0db486820
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,9 +280,11 @@ 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 !*flagScanVendor {
|
||||||
if vendor.MatchString(pkg) {
|
if vendor.MatchString(pkg) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
}
|
||||||
packages = append(packages, resolvePackage(pkg, gopaths))
|
packages = append(packages, resolvePackage(pkg, gopaths))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue