pflag icon indicating copy to clipboard operation
pflag copied to clipboard

Misleading documentation for func StringToStringVar

Open fxierh opened this issue 11 months ago • 1 comments

Quoting from the documentation of func StringToStringVar:

The value of each argument will not try to be separated by comma.

However with the following program:

res := make(map[string]string)
flag.StringToStringVar(&res, "foo-flag", res, "foo-flag-usage")
flag.Parse()

go run ... --foo-flag "foo=bar,baz=quux" results in res = map[baz:quux foo:bar].

fxierh avatar Mar 18 '24 18:03 fxierh

I'm happy to submit a PR for this if needed.

fxierh avatar Mar 18 '24 18:03 fxierh