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

Sprintf bug #612

Closed
petar opened this issue Feb 20, 2010 · 2 comments
Closed

Sprintf bug #612

petar opened this issue Feb 20, 2010 · 2 comments

Comments

@petar
Copy link
Contributor

petar commented Feb 20, 2010

Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull -u" and retry what you did to
reproduce the problem.  Thanks.

What steps will reproduce the problem?

        fmt.Printf("%5s|\n", "a")
        fmt.Printf("%5s|\n", "aa")
        fmt.Printf("%5s|\n", "aaa")
        fmt.Printf("%5s|\n", "a·a")


What is the expected output? What do you see instead?

The bar "|" should be at the same column for all. It is not
for the last Printf, which has a non-keyboard character (the mid-dot).

What is your $GOOS?  $GOARCH?

darwin, amd64

Which revision are you using?  (hg identify)
0692c79ada0a+ tip

Please provide any additional information below.
@gopherbot
Copy link
Contributor

Comment 1 by robpike:

This isn't so obvious.
ANSI C defines printf to count bytes, not characters, when padding.  The current code
implements the ANSI C 
spec on purpose.  Go does not have to be the same, but it also does not have to be
gratuitously different.
Opinions welcome.
-rob

@robpike
Copy link
Contributor

robpike commented Feb 28, 2010

Comment 2:

This issue was closed by revision a627d61.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
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

3 participants