You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my usage I expose structure fields as flags. The structures are offered by external packages and have default values. Here is an example:
// get the config with default valuescfg:=package1.NewConfig()
// expose some fields as flagsflag.DurationVar(&cfg.Field1, "config-field1", cfg.Field1, "description")
flag.DurationVar(&cfg.Field2, "config-field2", cfg.Field2, "description")
The problem is that current implementation is prone to copy-paste errors.
Proposal Details
Implement flag.VarDefault() functions that would take the default value from the variable itself. For example:
should equal to:
If approved, I would like to implement this myself.
The text was updated successfully, but these errors were encountered: