Skip to content

strconv: ParseBool errors are verbose #29306

@alandonovan

Description

@alandonovan

Failure to parse a boolean flag results in this error:

https://play.golang.org/p/cBBLtiFyWhY:
invalid boolean value "garbage" for -b: strconv.ParseBool: parsing "garbage": invalid syntax

Room for improvement:

  • display the offending value only once
  • don't mention strconv.ParseBool, as it is an internal detail.
  • state what values are allowed, perhaps?

The other strconv.Parse* functions are similarly verbose. I've gotten into the habit of throwing away their errors and writing my own. e.g. "invalid int: %q".

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions