weaveworks / common

Libraries used in multiple Weave projects
Other
129 stars 92 forks source link

Split setting of default values and registering flags. #206

Closed pstibrany closed 3 years ago

pstibrany commented 3 years ago

This PR proposes to split setting of default values and flag registration. This allows clients to modify default values, and have correct help message printed, by using:

    var cfg Config
    cfg.DefaultValues()
    cfg.RegisterInstrumentation = false
    cfg.RegisterFlags(flag.CommandLine)

I'd like to know what you think about this idea.

bboreham commented 3 years ago

I don't think I want this as a breaking change. I think it could be expressed as a new method with backwards-compatible behaviour on the old one.

pstibrany commented 3 years ago

Thanks. Decided not to go forward with this approach.