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: Scanf not waiting for input #48816

Closed
PaulDotSH opened this issue Oct 6, 2021 · 2 comments
Closed

fmt: Scanf not waiting for input #48816

PaulDotSH opened this issue Oct 6, 2021 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@PaulDotSH
Copy link

PaulDotSH commented Oct 6, 2021

What version of Go are you using (go version)?

What operating system and processor architecture are you using (go env)?

go1.17.1 windows/amd64

Does this issue reproduce with the latest release?

Yes

What did you do?

https://play.golang.org/p/TDFYs8OyOMZ

When I try to get input with fmt.Scanf (fmt.Scanf("%g",&numberFloat) and fmt.Scanf("%d", &base)), the first Scanf works on my windows machine but the second doesn't wait for input, in golang playground it doesn't wait for any input

What did you expect to see?

Scanf waiting for input

What did you see instead?

Scanf being ignored

@mattn
Copy link
Member

mattn commented Oct 6, 2021

Related issues #5391 #23562

@mknyszek mknyszek changed the title fmt.Scanf not waiting for input (Issue 5391 isn't fixed) fmt: Scanf not waiting for input Oct 6, 2021
@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 6, 2021
@mknyszek mknyszek added this to the Backlog milestone Oct 6, 2021
@mknyszek
Copy link
Contributor

mknyszek commented Oct 6, 2021

Judging by the documentation, and comments in #23562, a workaround is to add a newline, so fmt.Scanf("%d\n", &myInt).

That aside, I think this may be a duplicate of #23562. I encourage you to post there. Closing for now.

@mknyszek mknyszek closed this as completed Oct 6, 2021
@golang golang locked and limited conversation to collaborators Oct 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants