Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strconv: ParseBool errors are verbose #29306

Open
alandonovan opened this issue Dec 17, 2018 · 2 comments
Open

strconv: ParseBool errors are verbose #29306

alandonovan opened this issue Dec 17, 2018 · 2 comments
Labels
NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@alandonovan
Copy link
Contributor

alandonovan commented Dec 17, 2018

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

@ALTree ALTree added this to the Unplanned milestone Dec 17, 2018
@ALTree ALTree added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Dec 17, 2018
@agnivade
Copy link
Contributor

/cc @robpike

@Puthranps
Copy link

If this proposal gets approved I can work on it if possible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

4 participants