Skip to content

Can't pass empty int slices #222

@gbl08ma

Description

@gbl08ma

I have a IntSliceVar flag called groups. I can't seem to be able to pass empty slices in any way:

If I use --groups=[],
Error: invalid argument "[]" for "--groups" flag: strconv.Atoi: parsing "[]": invalid syntax

If I use --groups="",
Error: invalid argument "" for "--groups" flag: strconv.Atoi: parsing "": invalid syntax

Is there another syntax I'm missing?
This is part of a command-line program that uses cobra but I believe the problem to be within pflag (even though the error handling, that is printing the above errors and returning before I can get to my command handler, appears to be within cobra).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions