1
0
mirror of https://github.com/securego/gosec.git synced 2025-01-22 03:09:59 +02:00

Merge pull request #46 from drewwells/feature/exclusions

prefix patterns with **/ to match subdirectories
This commit is contained in:
Grant Murphy 2016-08-28 11:15:29 -07:00 committed by GitHub
commit e4b1e28f53

View File

@ -57,6 +57,11 @@ func (f *filelist) Contains(pathname string) bool {
return true
}
// match file suffixes ie. *_test.go
if matched, _ := filepath.Match(filepath.Join("**", pattern), pathname); matched {
return true
}
// Finally try absolute path
st, e := os.Stat(rel)
if os.IsExist(e) && st.IsDir() && strings.HasPrefix(abs, rel) {