gocarina / gocsv

The GoCSV package aims to provide easy CSV serialization and deserialization to the golang programming language
MIT License
1.95k stars 243 forks source link

Fix nested non marshaling structs prefixing #238

Closed jozseftiborcz closed 1 year ago

jozseftiborcz commented 1 year ago

Hi,

I ran into a problem when a struct contained a CreatedAt field and one of its substruct (eg. Inner) also contained a name with the same field name. The type of both fields were time.Time. When exported to CSV the column name of Inner was not prefixed with "Inner", so in the resulting header field list CreatedAt occured two times.

I expected CreatedAt and Inner.CreatedAt as column names instead of CreatedAt, CreatedAt.

After some debugging I hope I was able to find the root cause and provide a fix for it. I created a test case too.

Thx, joe

pikanezi commented 1 year ago

Thanks!