field: get underlying element if pointer

This commit is contained in:
Fatih Arslan 2014-08-17 12:57:22 +03:00
parent 1c1b7ed9a8
commit bb0405ceab

View File

@ -77,6 +77,10 @@ func (f *Field) Set(val interface{}) error {
given := reflect.ValueOf(val)
if given.Kind() == reflect.Ptr {
given = given.Elem()
}
if v.Kind() != given.Kind() {
return fmt.Errorf("wrong kind: %s want: %s", given.Kind(), v.Kind())
}