From b756ad73e9fab08611349ca3bdc38ffb6c601632 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 28 Feb 2024 09:50:42 -0500 Subject: [PATCH] fix: skip unexported fields --- config/config.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/config.go b/config/config.go index 6ed5eea..3cb7e14 100644 --- a/config/config.go +++ b/config/config.go @@ -169,6 +169,10 @@ func (m *Manager) validateObject(obj interface{}) error { field := objValue.Field(i) fieldType := objType.Field(i) + if !field.CanInterface() { + continue + } + // 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.Ptr && field.IsNil() {