This is a feature request, not a bug.
It would possibly be useful to be able to do something like this:
cfg, err := ini.LazyLoad("./foo.ini", "/usr/local/etc/foo.ini", "/etc/foo.ini")
Instead of overwriting keys or creating shadow keys, LazyLoad would stop after the first successful loading of an ini file.
This could be done two ways:
-
Passing a new LoadOptions field named something like AllowShortCircuit to LoadSources.
-
Repeated calling LoadSources from LazyLoad.
LazyLoad is perhaps not the best name, but I am not very creative with names.
I might work on this myself, but it will be a couple of weeks before I have the time.
Edit to add: Obviously this can be done already with nested if statements, or a helper function.
This is a feature request, not a bug.
It would possibly be useful to be able to do something like this:
cfg, err := ini.LazyLoad("./foo.ini", "/usr/local/etc/foo.ini", "/etc/foo.ini")Instead of overwriting keys or creating shadow keys, LazyLoad would stop after the first successful loading of an ini file.
This could be done two ways:
Passing a new LoadOptions field named something like AllowShortCircuit to LoadSources.
Repeated calling LoadSources from LazyLoad.
LazyLoad is perhaps not the best name, but I am not very creative with names.
I might work on this myself, but it will be a couple of weeks before I have the time.
Edit to add: Obviously this can be done already with nested if statements, or a helper function.