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
Assignees
Milestone

Comments

@RalphCorderoy
Copy link

@RalphCorderoy RalphCorderoy commented Aug 25, 2015

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
@robpike robpike closed this in 2949985 Nov 20, 2015
@golang golang locked and limited conversation to collaborators Nov 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.