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: Indexed formatting of padded integer returns BADINDEX #9275

Closed
marcalc opened this issue Dec 12, 2014 · 2 comments
Closed

fmt: Indexed formatting of padded integer returns BADINDEX #9275

marcalc opened this issue Dec 12, 2014 · 2 comments

Comments

@marcalc
Copy link

@marcalc marcalc commented Dec 12, 2014

fmt.Sprintf("%[1]v %[2]03d %[3]03d", "Text", 90, 80) should print "Text 090 080" but instead prints "Text %!d(BADINDEX) %!d(BADINDEX)"

Tested on Go 1.4

Am I doing something wrong?

@josharian
Copy link
Contributor

@josharian josharian commented Dec 12, 2014

The index goes next to the verb: fmt.Sprintf("%[1]v %03[2]d %03[3]d", "Text", 90, 80). http://play.golang.org/p/_bGrb91xTJ

@marcalc
Copy link
Author

@marcalc marcalc commented Dec 12, 2014

Thanks, Josh!

Sent from my iPhone

On 11/12/2014, at 23:13, Josh Bleecher Snyder notifications@github.com wrote:

The index goes next to the verb: fmt.Sprintf("%[1]v %03[2]d %03[3]d", "Text", 90, 80). http://play.golang.org/p/_bGrb91xTJ


Reply to this email directly or view it on GitHub.

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