]> Cypherpunks repositories - gostls13.git/commit
fmt: give correct error for % at end of string when scanning
authorRob Pike <r@golang.org>
Fri, 20 Nov 2015 21:17:32 +0000 (13:17 -0800)
committerRob Pike <r@golang.org>
Fri, 20 Nov 2015 21:50:54 +0000 (21:50 +0000)
commit29499858bfa616b19c5108510d3cc6c9fa937bcc
tree231f256b0c9f4b00e3fd8de9d77b57e239ffba39
parentaf8cd3f6bdca237b3a843d66031c568f4679de73
fmt: give correct error for % at end of string when scanning

Previously it said, "bad verb %% for ...", which is not only wrong,
it's ironic as the fix is to use %% rather than % at the end of the
string. Diagnose the case where a simple % is at EOF.

If there's anything after the percent, the error is already good
but this CL also puts quotes around the verb designation ('%d' etc.)
to make it even clearer, especially when there is a space involved.

Fixes #12315.

Change-Id: I31d30659965e940d0bd9ce92a475aab3e2369ef0
Reviewed-on: https://go-review.googlesource.com/17150
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/fmt/scan.go
src/fmt/scan_test.go