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
Milestone

Comments

@alandonovan
Copy link
Contributor

@alandonovan 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
@agnivade

This comment has been minimized.

Copy link
Contributor

@agnivade agnivade commented Dec 18, 2018

/cc @robpike

@Puthranps

This comment has been minimized.

Copy link

@Puthranps Puthranps commented Jan 2, 2019

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
Projects
None yet
4 participants
You can’t perform that action at this time.