INNER CODE UNIT · Go
ParseNestedFields
ozontech/file.d · cfg/config.go:646
func ParseNestedFields(fields []string) ([][]string, error) {
if len(fields) == 0 {
return nil, errors.New("empty fields list")
}
paths := make([][]string, 0, len(fields))
for _, field := range fields {
path := ParseFieldSelector(field)
if len(path) == 0 {
return nil, errors.New("empty path parsed")
}
paths = append(paths, path)
}
sort.Slice(paths, func(i, j int) bool {
return len(paths[i]) < len(paths[j])