-
Notifications
You must be signed in to change notification settings - Fork 374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip empty shadow values when saving to file #294
Comments
func main() {
cfg:= ini.Empty(ini.LoadOptions{AllowDuplicateShadowValues: true, AllowShadows: true})
// add configs
cfg.Section("Match").Key("Name").SetValue("eth0")
for _, v := range []string{"1.2.3.4", "5.6.7.8"} {
cfg.Section("Network").Key("DNS").AddShadow(v)
}
var b bytes.Buffer
if _, err := cfg.WriteTo(&b); err != nil {
fmt.Println("Failed to write to config", err)
}
fmt.Println(b.String())
} outputs [Match]
Name = eth0
[Network]
DNS =
DNS = 1.2.3.4
DNS = 5.6.7.8 |
Hey @dwmunster, not sure how I think the problem here is that the line |
https://github.com/go-ini/ini/releases/tag/v1.66.4 has been tagged for the fix. |
With below test store ini file is invalid:
Test method
And my fix to that is:
The text was updated successfully, but these errors were encountered: