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

flag: ignores failures when the flag is not parseable into a boolean #3869

Closed
gopherbot opened this issue Jul 26, 2012 · 2 comments
Closed

Comments

@gopherbot
Copy link

by manoj.dayaram@moovweb.com:

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. Create a new flagset and set the error handling to anything.
2. Register a boolean flag.
3. Parse the command arguments and print the value of any errors returned.
3. Run the program and pass a non boolean variable to the flag (something other than
'true' or 'false')
4. Example:  http://play.golang.org/p/tb_09vpnl9

What is the expected output?
Perform whatever the error handler dictates, either panic, exit, or continue on error
(returning the error).

What do you see instead?
The flag usage is printed, but we return from the Parse(..) function normally with a nil
error.


Which compiler are you using (5g, 6g, 8g, gccgo)?
Using go build


Which operating system are you using?
Ubuntu 12.04


Which version are you using?  (run 'go version')
go1.0.1 and go1.0.2
@robpike
Copy link
Contributor

robpike commented Jul 27, 2012

Comment 1:

Labels changed: added priority-asap, removed priority-triage.

Owner changed to @robpike.

Status changed to Started.

@robpike
Copy link
Contributor

robpike commented Jul 27, 2012

Comment 2:

This issue was closed by revision 48ca3f2.

Status changed to Fixed.

robpike added a commit that referenced this issue May 11, 2015
««« backport a36c0344826a
flag: fix bug in handling of booleans on error
Fixes #3869.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6448072

»»»
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc unassigned robpike Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants