fix: skip unexported fields

This commit is contained in:
Derrick Hammer 2024-02-28 09:50:42 -05:00
parent 6b7724eb51
commit b756ad73e9
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 0 deletions

View File

@ -169,6 +169,10 @@ func (m *Manager) validateObject(obj interface{}) error {
field := objValue.Field(i) field := objValue.Field(i)
fieldType := objType.Field(i) fieldType := objType.Field(i)
if !field.CanInterface() {
continue
}
// If field is a struct or pointer to a struct, recurse // If field is a struct or pointer to a struct, recurse
if field.Kind() == reflect.Struct || (field.Kind() == reflect.Ptr && field.Elem().Kind() == reflect.Struct) { if field.Kind() == reflect.Struct || (field.Kind() == reflect.Ptr && field.Elem().Kind() == reflect.Struct) {
if field.Kind() == reflect.Ptr && field.IsNil() { if field.Kind() == reflect.Ptr && field.IsNil() {