Skip to content

Misleading documentation for func StringToStringVar #397

@fxierh

Description

@fxierh

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

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