fix: skip unexported fields
This commit is contained in:
parent
0ae69e5ba1
commit
6b7724eb51
|
@ -117,6 +117,12 @@ func (m *Manager) setDefaultsForObject(obj interface{}, prefix string) {
|
||||||
for i := 0; i < objValue.NumField(); i++ {
|
for i := 0; i < objValue.NumField(); i++ {
|
||||||
field := objValue.Field(i)
|
field := objValue.Field(i)
|
||||||
fieldType := objType.Field(i)
|
fieldType := objType.Field(i)
|
||||||
|
|
||||||
|
// Check if the field is exported and can be interfaced
|
||||||
|
if !field.CanInterface() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
mapstructureTag := fieldType.Tag.Get("mapstructure")
|
mapstructureTag := fieldType.Tag.Get("mapstructure")
|
||||||
|
|
||||||
// Construct new prefix based on the mapstructure tag, if available
|
// Construct new prefix based on the mapstructure tag, if available
|
||||||
|
|
Loading…
Reference in New Issue