What did you expect to see?
I would expect promoted fields to be recognized by the library so redundancy can be avoided for common fields and behavior.
What did you see instead?
Will always result in could not find field matching Name because core/write.go.findFieldIndex() doesn't check promoted fields.
Promoted fields can be checked using the following condition:
field := s.Field(i)
fieldType := sType.Field(i)
if field.Kind() == reflect.Struct && fieldType.Anonymous {
// This field is a promoted struct
}
(Variable names are based on what's used in core/write.go.findFieldIndex().)
What operating system and terminal are you using?
go version go1.16 linux/amd64
An example that showcases the bug.
What did you expect to see? I would expect promoted fields to be recognized by the library so redundancy can be avoided for common fields and behavior.
What did you see instead? Will always result in
could not find field matching Name
becausecore/write.go.findFieldIndex()
doesn't check promoted fields.Promoted fields can be checked using the following condition:
(Variable names are based on what's used in
core/write.go.findFieldIndex()
.)