Skip to content

size: be more forgiving with size inputΒ #27

Description

@andres-lowrie

So the following fails because the size format defaults to iec πŸ‘

❯ go run main.go --into size 2500000M
val size
format size
input 2500000M
direction into
(bool) false
(*errors.errorString)(0xc00008e260)(Unknown unit suffix)
into into
true
Output Err: Input unparsable for `size`

Which makes total sense but it would be nice if this thing knew that I wanted "SI" units and just didn't specify that.

There may be a bit of a chicken and egg scenario here given that the units are set before the parsers are ran. This format (size) may be a good candidate to break the mold with in that perhaps it should should figure which struct to instantiate based on which parser runs successfully

Looks like the GetParsers method is not being used yet and perhaps this use case was the reason I included it in the first place ... lol 🀷

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementEnhancement or feature requestparsersRelated to parser package

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions