This comes down to not exposing the field names of nested structs as a fieldInfo if the struct implements UnmarshalText or UnmarshalCSV. https://github.com/gocarina/gocsv/commit/eeb477f6ec9dd44065df8d0960bc9ef37f4153ea already prevented the same if the struct implements MarshalCSV or MarshalText, but I would say that this should also be the case if just one or both of the unmarshaling methods are defined.
Otherwise, an exported field from a nested structure will shadow the intended unmarshaling behavior of the top-level structure if one of its fields has the same name as a field of the nested structure itself. See the added test for an example.
Changing this doesn't break any of the existing tests.
This comes down to not exposing the field names of nested structs as a
fieldInfo
if the struct implementsUnmarshalText
orUnmarshalCSV
. https://github.com/gocarina/gocsv/commit/eeb477f6ec9dd44065df8d0960bc9ef37f4153ea already prevented the same if the struct implementsMarshalCSV
orMarshalText
, but I would say that this should also be the case if just one or both of the unmarshaling methods are defined.Otherwise, an exported field from a nested structure will shadow the intended unmarshaling behavior of the top-level structure if one of its fields has the same name as a field of the nested structure itself. See the added test for an example.
Changing this doesn't break any of the existing tests.