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

fmt: Sscanf says 'bad verb %%' for format string '%d%' #12315

Closed
RalphCorderoy opened this issue Aug 25, 2015 · 0 comments
Closed

fmt: Sscanf says 'bad verb %%' for format string '%d%' #12315

RalphCorderoy opened this issue Aug 25, 2015 · 0 comments
Milestone

Comments

@RalphCorderoy
Copy link

fmt.Printf("%d%", 42) gives 42%!(NOVERB), spotting the percent with no following verb.
fmt.Sscanf("42 314", "%d%", &i, &j) with ints i and j returns an error of bad verb %% for integer.

No %% occurs in the format specifier. The cause is parsenum() winding back from being at the end of the string, having processed the second %, to just before it so it's used as the verb in the error.

@mikioh mikioh changed the title fmt.Sscanf() doesn't complain of missing verb, but of bad verb %%. fmt: Sscanf() doesn't complain of missing verb, but of bad verb %%. Aug 29, 2015
@rsc rsc changed the title fmt: Sscanf() doesn't complain of missing verb, but of bad verb %%. fmt: Sscanf says 'bad verb %%' for format string '%d%' Oct 23, 2015
@rsc rsc added this to the Go1.6 milestone Oct 23, 2015
@golang golang locked and limited conversation to collaborators Nov 27, 2016
@rsc rsc unassigned robpike Jun 23, 2022
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