Description
Describe the feature
We have a condition where our INI files have something like this example:
[section]
Key1=value1
Key2=
Key3=value3
We use code something like:
for _, section := cfg.Sections() {
// deal with some of the sections, per key, then...
for _, key := section.Keys() {
for _, value := key.ValueWithShadows() {
You get the idea. Anyway, we never see "Key2".
What I would like to have is an option where I get "Key2" with an empty string as the value.
Describe the solution you'd like
We'd like some sort of option we could add into the LoadSources, something like:
cfg, err := ini.LoadSources(ini.LoadOptions{AllowBlankValues: true, AllowShadows: true, SkipUnrecognizableLines: true, SpaceBeforeInlineComment: true}, outbytes.Bytes())
With a default of false, you keep the current way of not handling blank values.
Describe alternatives you've considered
As a work around, part of our syntax for the value allows some options, we enclose in curly braces, so we can make the INI parse with something like
[section]
Key1=value1
Key2={}
Key3=value3
Now, I get Key2 with a value of "{}". It would be nice not to have to have to do this.
So, if we could get a new LoadOptions setting, that would be groovy.
Additional context
Feel free to contact me if you have questions.
Code of Conduct
- I agree to follow this project's Code of Conduct
Activity