2018-10-21 17:06:51 +03:00
|
|
|
package packages
|
|
|
|
|
2018-10-28 19:35:12 +03:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"path/filepath"
|
2018-11-05 12:42:09 +03:00
|
|
|
"regexp"
|
2018-10-28 19:35:12 +03:00
|
|
|
)
|
|
|
|
|
2018-11-05 12:42:09 +03:00
|
|
|
func pathElemReImpl(e string, sep rune) string {
|
|
|
|
escapedSep := regexp.QuoteMeta(string(sep)) // needed for windows sep '\\'
|
|
|
|
return fmt.Sprintf(`(^|%s)%s($|%s)`, escapedSep, e, escapedSep)
|
|
|
|
}
|
|
|
|
|
2018-10-28 19:35:12 +03:00
|
|
|
func pathElemRe(e string) string {
|
2018-11-05 12:42:09 +03:00
|
|
|
return pathElemReImpl(e, filepath.Separator)
|
2018-10-28 19:35:12 +03:00
|
|
|
}
|
|
|
|
|
2018-10-21 17:06:51 +03:00
|
|
|
var StdExcludeDirRegexps = []string{
|
2018-10-28 19:35:12 +03:00
|
|
|
pathElemRe("vendor"),
|
|
|
|
pathElemRe("third_party"),
|
|
|
|
pathElemRe("testdata"),
|
|
|
|
pathElemRe("examples"),
|
|
|
|
pathElemRe("Godeps"),
|
|
|
|
pathElemRe("builtin"),
|
2018-10-21 17:06:51 +03:00
|
|
|
}
|