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

proposal: strconv: Teach UnquoteChar to distinguish unexpected EOF from syntax errors #19107

Closed
navytux opened this issue Feb 15, 2017 · 1 comment

Comments

@navytux
Copy link
Contributor

navytux commented Feb 15, 2017

I propose to make the following change:

teach strconv.UnquoteChar to return io.ErrUnexpectedError instead of strconv.ErrSyntax when it sees truncated but otherwise valid input.

This is needed to get proper error reporting in situations where UnquoteChar is used to decode input stream step by step: there if we see truncated version of valid character as input always returning ErrSyntax effectively blocks caller from determining what it was - a real syntax error or unexpected end of stream.

Since UnquoteChar is internally used by Unquote, but Unquote always operates on complete input, Unquote error behaviour should be preserved to return ErrSyntax in all cases.

CL which implements this change: https://go-review.googlesource.com/37052/

/cc @rsc, @robpike, @Sajmani, @minux

@navytux
Copy link
Contributor Author

navytux commented Feb 15, 2017

Closing as per comments in https://go-review.googlesource.com/37052/ .

@navytux navytux closed this as completed Feb 15, 2017
@golang golang locked and limited conversation to collaborators Feb 15, 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

2 participants