INNER CODE UNIT · Go
ListToMap
ozontech/file.d · cfg/config.go:792
func ListToMap(a []string) map[string]bool {
result := make(map[string]bool, len(a))
for _, key := range a {
result[key] = true
}
return result
}
func CompileRegex(s string) (*regexp.Regexp, error) {
if s == "" {
return nil, fmt.Errorf(`regexp is empty`)
}
if s == "/" || s[0] != '/' || s[len(s)-1] != '/' {
return nil, fmt.Errorf(`regexp "%s" should be surrounded by "/"`, s)
}