fixup! Add warning and critical thresholds to options
This commit is contained in:
@@ -110,6 +110,18 @@ func setFieldValue(field reflect.Value, value string, fieldType reflect.Type) er
|
|||||||
}
|
}
|
||||||
field.Set(slice)
|
field.Set(slice)
|
||||||
}
|
}
|
||||||
|
case reflect.Float32:
|
||||||
|
floatValue, err := strconv.ParseFloat(value, 32)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("invalid float value: %w", err)
|
||||||
|
}
|
||||||
|
field.SetFloat(floatValue)
|
||||||
|
case reflect.Float64:
|
||||||
|
floatValue, err := strconv.ParseFloat(value, 64)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("invalid float value: %w", err)
|
||||||
|
}
|
||||||
|
field.SetFloat(floatValue)
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("unsupported field type: %s", fieldType.Kind())
|
return fmt.Errorf("unsupported field type: %s", fieldType.Kind())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user