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

Instancing global configuration values #247

Open lumapat opened 1 year ago

lumapat commented 1 year ago

I was working with gocsv to replace a CSV utility, and I noticed that configuration params were global (e.g. FailIfUnmatchedStructTags). Any reason why we shouldn’t be instancing these values with each Reader (or perhaps a separate Reader)?

Particularly for my use case, we can’t exactly enable these configurations globally since that would break more flexible instances of gocsv decoding that are live with existing external users (in production).

If there isn’t a reason, would love to contribute a new reader that takes those values instanced instead.

shigetaichi commented 1 year ago

@lumapat I’ve created a new package that does not use global variables, and I have used gocsv as a reference for most of the csv generation process. (Thanks to all gocsv contributors.) I hope the ideas are helpful to you. https://github.com/shigetaichi/xsv