INNER CODE UNIT · Go

ParseSlice

ozontech/file.d · cfg/config.go:408

func ParseSlice(v reflect.Value, values map[string]int) error {
	for i := 0; i < v.Len(); i++ {
		if err := Parse(v.Index(i).Addr().Interface(), values); err != nil {
			return err
		}
	}
	return nil
}

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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…