@@ -178,23 +178,43 @@ func init() {
178178 Log ("Concurrency:" , concurrency )
179179 goSrc = func () []string {
180180 results := new ([]string )
181- filepath .Walk ("." , func (path string , info os.FileInfo , err error ) error {
181+ filepath .Walk ("." , func (relpath string , info os.FileInfo , err error ) error {
182+ // Ensure absolute path so globs work
183+ path , err := filepath .Abs (relpath )
184+ if err != nil {
185+ panic (err )
186+ }
187+
182188 // Look for files
183189 if info .IsDir () {
184190 return nil
185191 }
192+
186193 // Exclusions
187- if matched , _ := filepath .Match ("*/vendor/*" , path ); matched {
188- return nil
189- } else if matched , _ := filepath .Match (fmt .Sprintf ("%s/*" , toolDir ), path ); matched {
190- return nil
191- } else if matched , _ := filepath .Match (fmt .Sprintf ("%s/*" , binDir ), path ); matched {
194+ for _ , exclusion := range []string {toolDir , binDir , releaseDir , coverageDir } {
195+ if strings .HasPrefix (path , exclusion ) {
196+ if info .IsDir () {
197+ return filepath .SkipDir
198+ }
199+ return nil
200+ }
201+ }
202+
203+ if strings .Contains (path , "/vendor/" ) {
204+ if info .IsDir () {
205+ return filepath .SkipDir
206+ }
192207 return nil
193- } else if matched , _ := filepath .Match (fmt .Sprintf ("%s/*" , releaseDir ), path ); matched {
208+ }
209+
210+ if strings .Contains (path , ".git" ) {
211+ if info .IsDir () {
212+ return filepath .SkipDir
213+ }
194214 return nil
195215 }
196216
197- if matched , _ := filepath . Match ( "* .go", path ); ! matched {
217+ if ! strings . HasSuffix ( path , " .go") {
198218 return nil
199219 }
200220
0 commit comments