Skip to content

Conf.ConfigFileVariable doesn't support 'short:' option #35

Open
@costela

Description

@costela

Setting the short: struct tag on the config element referred to by ConfigFileVariable is currently a noop. Currently the docs are unclear about this little gotcha.

E.g.: using something like:

var conf = &struct{
    ConfPath string `id:"confpath" short:"c"`
}{}

gonfig.Load(&conf, gonfig.Conf{
        ConfigFileVariable:  "confpath",
})

And then calling go run . -c /some/file will generate no errors, since the -c flag is recognized, but its value is ignored when searching the actual config file.

I suspect this is something we can work around in lookupConfigFileFlag() (maybe just naively check flagsMap[configOpt.short]?) but it just wasn't enough of an itch for me to scratch. So I'm leaving the issue here until either I get around to it, or someone else beats me to it! 😉

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions