INNER CODE UNIT · Go
ParseField
ozontech/file.d · cfg/config.go:417
func ParseField(v reflect.Value, vField reflect.Value, tField *reflect.StructField, values map[string]int) error {
tag := tField.Tag.Get("options")
if tag != "" {
parts := strings.Split(tag, "|")
if vField.Kind() != reflect.String {
return fmt.Errorf("options deals with strings only, but field %s has %s type", tField.Name, tField.Type.Name())
}
idx := -1
found := false
for i, part := range parts {
if vField.String() == part {
found = true
idx = i
break
}
}