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: fix padding with 0 modifier when precision is set for integers #15331

Closed
martisch opened this issue Apr 16, 2016 · 1 comment
Closed

fmt: fix padding with 0 modifier when precision is set for integers #15331

martisch opened this issue Apr 16, 2016 · 1 comment

Comments

@martisch
Copy link
Contributor

martisch commented Apr 16, 2016

go tip:

fmt.Printf("|%6.2d|\n",0)
fmt.Printf("|%6.d|\n",0)
fmt.Printf("|%06.2d|\n",0)
fmt.Printf("|%06.d|\n",0)

output:

|    00|
|      |
|00|
|000000|

the last two lines should be like the first two lines:

|    00|
|      |

precision should cancel the 0 modifier like it does in C.

@gopherbot
Copy link

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

@martisch martisch changed the title fmt: inconsistent zero padding for integers when precision is set fmt: fix padding with 0 modifier when precision is set for integers Apr 16, 2016
@golang golang locked and limited conversation to collaborators Apr 18, 2017
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

2 participants