mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-12 03:26:30 +00:00
c28f7cb29f
Initial part of #435
25 lines
528 B
Go
25 lines
528 B
Go
package packages
|
|
|
|
import (
|
|
"fmt"
|
|
"path/filepath"
|
|
"regexp"
|
|
)
|
|
|
|
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)
|
|
}
|
|
|
|
func pathElemRe(e string) string {
|
|
return pathElemReImpl(e, filepath.Separator)
|
|
}
|
|
|
|
var StdExcludeDirRegexps = []string{
|
|
pathElemRe("vendor"),
|
|
pathElemRe("third_party"),
|
|
pathElemRe("testdata"),
|
|
pathElemRe("examples"),
|
|
pathElemRe("Godeps"),
|
|
pathElemRe("builtin"),
|
|
}
|