fix(package): [structs] recognise directly embedded fields (#403)

This commit is contained in:
Yusuf Efe authored and GitHub committed 2026-10-22 10:28:54 +08:00
1 parent 3b94ec1932
commit ef22b5b339
2 files changed
+24 -1

No files matched your search

+1 -1
View File
@@ -40,7 +40,7 @@ func (f *Field) Value() any {
// IsEmbedded returns true if the given field is an embedded field.
// Play: https://go.dev/play/p/wV2PrbYm3Ec
func (f *Field) IsEmbedded() bool {
return len(f.field.Index) > 1
return f.field.Anonymous || len(f.field.Index) > 1
}
// IsExported returns true if the given field is exported.