You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation says this about the behaviour of the * modifier (emphasis mine):
Width and precision are measured in units of Unicode code points, that is, runes. (This differs from C's printf where the units are always measured in bytes.) Either or both of the flags may be replaced with the character '*', causing their values to be obtained from the next operand, which must be of type int.
I was therefore expecting that Printf would get the width from the argument following the one to be formatted, rather than the preceding one. I think the wording could be clarified, such as by specifying "causing their values to be obtained from the next operand, before obtaining the value to be formatted", and/or by adding an example.
The text was updated successfully, but these errors were encountered:
The arguments are read left to right. That's always the case.
The problem is with the word 'next', which is so vexing in conversation that people construct circumlocutions for clarity, as in "The next Tuesday we will experience." It seems unlikely we need to invent verbiage for this.
What version of Go are you using (
go version
)?go version go1.9 darwin/amd64
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?What did you do?
Run this program: https://play.golang.org/p/uBOhH86MEv
What did you expect to see?
The program prints:
What did you see instead?
It prints the following instead:
The documentation says this about the behaviour of the
*
modifier (emphasis mine):I was therefore expecting that
Printf
would get the width from the argument following the one to be formatted, rather than the preceding one. I think the wording could be clarified, such as by specifying "causing their values to be obtained from the next operand, before obtaining the value to be formatted", and/or by adding an example.The text was updated successfully, but these errors were encountered: