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 should also accept "on" #21932

Closed
kristofferingemansson opened this issue Sep 19, 2017 · 2 comments
Closed

strconv: ParseBool should also accept "on" #21932

kristofferingemansson opened this issue Sep 19, 2017 · 2 comments

Comments

@kristofferingemansson
Copy link

HTML forms submit checkboxes as "on" when checked.
I think that strconv.ParseBool should return true for input str "on" as it would make parsing form data much easier.

https://github.com/golang/go/blob/release-branch.go1.9/src/strconv/atob.go#L12

I'm using: Go 1.8 on Windows

@mdempsky mdempsky changed the title strconv.ParseBool should also accept "on" strconv: ParseBool should also accept "on" Sep 19, 2017
@mdempsky
Copy link
Member

I think this is unlikely to change. Arguably it would be backwards incompatible, since the Go 1 docs specifically say inputs other than those enumerated will return an error.

@ianlancetaylor
Copy link
Contributor

ParseBool is not intended for HTML form submit checkboxes. it's easy enough to write your own function. Closing.

@golang golang locked and limited conversation to collaborators Sep 20, 2018
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

4 participants