You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe there should be a check on field.isValid() AND sel.isExported() or not. If exported then field.Interface(), otherwise need to do something like this.
// ......
if field.IsValid() && sel.IsExported() {
return field.Interface(), nil
} else if field.IsValid() && !sel.IsExported() {
k := rVal.FieldByName(sel.Name)
if k.CanAddr() { // can address
k = reflect.NewAt(k.Type(), unsafe.Pointer(k.UnsafeAddr())).Elem()
} else { // can't address
switch k.Kind() {
case reflect.String:
return k.String(), nil
// ......
default:
return k.Interface(), nil
}
}
return k.Interface(), nil
}
The text was updated successfully, but these errors were encountered:
reflect panic when trying to access an unexported field in a struct. For example :
Access to a.unexp will panic. Problem is here..
go-pry/pry/interpreter.go
Line 226 in f6e6fbd
I believe there should be a check on
field.isValid()
ANDsel.isExported()
or not. If exported thenfield.Interface()
, otherwise need to do something like this.The text was updated successfully, but these errors were encountered: