-
Notifications
You must be signed in to change notification settings - Fork 238
Open
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
create a structInfo but the always inculde unexported field
Lines 129 to 139 in 5fca2dc
func (c *cache) create(t reflect.Type, parentAlias string) *structInfo { | |
info := &structInfo{} | |
var anonymousInfos []*structInfo | |
for i := 0; i < t.NumField(); i++ { | |
if f := c.createField(t.Field(i), parentAlias); f != nil { | |
info.fields = append(info.fields, f) | |
if ft := indirectType(f.typ); ft.Kind() == reflect.Struct && f.isAnonymous { | |
anonymousInfos = append(anonymousInfos, c.create(ft, f.canonicalAlias)) | |
} | |
} | |
} |
Expected Behavior
create a structInfo but the skip unexported field
// create creates a structInfo with meta-data about a struct.
func (c *cache) create(t reflect.Type, parentAlias string) *structInfo {
info := &structInfo{}
var anonymousInfos []*structInfo
for i := 0; i < t.NumField(); i++ {
field := t.Field(i)
// !!! skip unexported field
if !field.IsExported() {
continue
}
if f := c.createField(field, parentAlias); f != nil {
info.fields = append(info.fields, f)
if ft := indirectType(f.typ); ft.Kind() == reflect.Struct && f.isAnonymous {
anonymousInfos = append(anonymousInfos, c.create(ft, f.canonicalAlias))
}
}
}
Steps To Reproduce
No response
Anything else?
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status