@@ -13,7 +13,12 @@ import (
13
13
"github.com/sirupsen/logrus"
14
14
)
15
15
16
- var stdExcludeDirs = []string {"vendor" , "testdata" , "examples" , "Godeps" , "builtin" }
16
+ var stdExcludeDirRegexps = []string {
17
+ "^vendor$" , "^third_party$" ,
18
+ "^testdata$" , "^examples$" ,
19
+ "^Godeps$" ,
20
+ "^builtin$" ,
21
+ }
17
22
18
23
func GetProjectRoot () string {
19
24
return path .Join (build .Default .GOPATH , "src" , "github.com" , "golangci" , "golangci-worker" )
@@ -101,7 +106,7 @@ func processResolvedPaths(paths *PathResolveResult) (*ProjectPaths, error) {
101
106
}, nil
102
107
}
103
108
104
- func GetPathsForAnalysis (ctx context.Context , inputPaths []string , includeTests bool ) (ret * ProjectPaths , err error ) {
109
+ func GetPathsForAnalysis (ctx context.Context , inputPaths []string , includeTests bool , skipDirRegexps [] string ) (ret * ProjectPaths , err error ) {
105
110
defer func (startedAt time.Time ) {
106
111
if ret != nil {
107
112
logrus .Infof ("Found paths for analysis for %s: %s" , time .Since (startedAt ), ret .MixedPaths ())
@@ -114,7 +119,13 @@ func GetPathsForAnalysis(ctx context.Context, inputPaths []string, includeTests
114
119
}
115
120
}
116
121
117
- pr := NewPathResolver (stdExcludeDirs , []string {".go" }, includeTests )
122
+ // TODO: don't analyze skipped files also, when be able to do it
123
+ excludeDirs := append ([]string {}, stdExcludeDirRegexps ... )
124
+ excludeDirs = append (excludeDirs , skipDirRegexps ... )
125
+ pr , err := NewPathResolver (excludeDirs , []string {".go" }, includeTests )
126
+ if err != nil {
127
+ return nil , fmt .Errorf ("can't make path resolver: %s" , err )
128
+ }
118
129
paths , err := pr .Resolve (inputPaths ... )
119
130
if err != nil {
120
131
return nil , fmt .Errorf ("can't resolve paths %v: %s" , inputPaths , err )
0 commit comments