Denis Isaev 3345c7136f fix #264: fix Windows compatibility
Fix skip-dirs regexps and 'go env' on Windows.
2018-11-05 12:54:40 +03:00

26 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"),
}