cast
cast copied to clipboard
Cast to reflect.Value
This would be pretty nice building block for reflect type casting; something like:
cast.ToReflectValue(i interface{}, value reflect.Values) error
What is reflect.Values
and what is its purpose in that function?
What's wrong with just doing v := reflect.ValueOf(i)
?
I want to set it. That is for example:
cast.ToReflectValues("10s", x)
would set the x to duration 10s if x is of type duration