-
Notifications
You must be signed in to change notification settings - Fork 18k
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
fmt: Sscanf doc disagrees with implementation #12788
Comments
There's no newline in input in the linked example, ie. there's nothing to match. Compare with, for example, http://play.golang.org/p/k8KMqjPRFa |
Yes, that's the point. According to the documentation, fmt.Sscanf should return an error in this case (as it does for, say, http://play.golang.org/p/T1_RAgYLC-). That is: according to the documentation, the newline in the format string should require a corresponding newline in the input string in order to return a nil error. It currently does not. |
CL https://golang.org/cl/16165 mentions this issue. |
Up to Rob. |
2 similar comments
Up to Rob. |
Up to Rob. |
https://golang.org/pkg/fmt/#Sscanf says:
However, in the current implementation, trailing newlines in the format string are treated as matching the end of the input string:
http://play.golang.org/p/r2f16aAYbS
Either the package documentation or the implementation should be updated. (Probably the package documentation, since a significant number of programs are likely already relying on this behavior.)
The text was updated successfully, but these errors were encountered: