fmt: require newlines to match when scanning with a format
The documentation says that newlines behave like this: Scan etc.: newlines are spaces. Scanln etc.: newlines terminate the scan. Scanf etc.: newlines must match in input and format. The code did not implement this behavior in all cases, especially for Scanf. Make it behave: - Fix the handling of spaces and newlines in ss.Advance. The code is longer but now behaves as it should. - Delete the reuse of the current ss in newScanState. There is really no need, since it's only used in recursive calls to Scan etc., and the flags are likely wrong. Simpler just to allocate a new one every time, and likelier to be correct. Fixes #10862. Change-Id: If060ac021017346723b0d62de4e5a305da898f68 Reviewed-on: https://go-review.googlesource.com/10991Reviewed-by:Andrew Gerrand <adg@golang.org>
Showing
Please register or sign in to comment