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 behaviour inconsistent with doc specification #10862

Closed
syst3mw0rm opened this issue May 15, 2015 · 4 comments
Closed

fmt: scanf behaviour inconsistent with doc specification #10862

syst3mw0rm opened this issue May 15, 2015 · 4 comments
Milestone

Comments

@syst3mw0rm
Copy link
Contributor

fmt doc says: Scanf, Fscanf and Sscanf require newlines in the input to match newlines in the format; the other routines treat newlines as spaces.

The following program spits out error (should not according to doc):

package main

import (
    "fmt"
    "log"
)

func main() {
    var a, b int
    _, err := fmt.Sscanf("1\n2", "%d %d", &a, &b)
    if err == nil {
        log.Fatalf("got - %q, expected - %q", err, "unexpected newline")
    }
}

on commit 335e44d

@ianlancetaylor ianlancetaylor added this to the Go1.5 milestone May 15, 2015
@robpike
Copy link
Contributor

robpike commented Jun 5, 2015

Duplicate of #9459

@robpike robpike closed this as completed Jun 5, 2015
@robpike
Copy link
Contributor

robpike commented Jun 5, 2015

Not a duplicate of #9459, sorry. This is a different issue; fix out for review in https://go-review.googlesource.com/10779

@robpike robpike reopened this Jun 5, 2015
@gopherbot
Copy link

CL https://golang.org/cl/10779 mentions this issue.

@gopherbot
Copy link

CL https://golang.org/cl/10991 mentions this issue.

@golang golang locked and limited conversation to collaborators Jun 25, 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