Skip to content

Short-circuit load #180

Description

@optimusgrue

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:

  1. Passing a new LoadOptions field named something like AllowShortCircuit to LoadSources.

  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureCategorizes as related to a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions