mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Merge pull request #115827 from borgerli/fix/construct-float
add missed case for float types
This commit is contained in:
commit
3ce7cdda1f
@ -173,6 +173,10 @@ func fill(dataString string, dataInt int, t reflect.Type, v reflect.Value, fillF
|
||||
// use Convert to set into int alias types and different int widths correctly
|
||||
v.Set(reflect.ValueOf(dataInt).Convert(t))
|
||||
|
||||
case reflect.Float32, reflect.Float64:
|
||||
// use Convert to set into float types
|
||||
v.Set(reflect.ValueOf(float32(dataInt) + 0.5).Convert(t))
|
||||
|
||||
default:
|
||||
panic(fmt.Errorf("unhandled type %v in field %s", t, dataString))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user