Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
fmt: missing bits of documentation #4206
http://play.golang.org/p/FT7yR1p4-_ What is the expected output? I expect both lines of output to be identical. What do you see instead? The output from "%7g" is not limited to 7 characters, but from "%7f" it is. Which compiler are you using (5g, 6g, 8g, gccgo)? Which operating system are you using? Which version are you using? (run 'go version') Please provide any additional information below.
The 7s in your example are doing nothing. Change them to 20s and you'll see what they do. We should make the docs clearer. godoc fmt: %e scientific notation, e.g. -1234.456e+78 %E scientific notation, e.g. -1234.456E+78 %f decimal point but no exponent, e.g. 123.456 %g whichever of %e or %f produces more compact output %G whichever of %E or %f produces more compact output ... For numeric values, width sets the width of the field and precision sets the number of places after the decimal, if appropriate. For example, the format %6.2f prints 123.45. For strings, width is the minimum number of characters to output, padding with spaces if necessary, and precision is the maximum number of characters to output, truncating if necessary. Missing: (1) for numeric values, width sets the *minimum* width of the field. (2) Default precision for e and f is 6; default precision for g is the smallest number of digits needed to uniquely identify the value.
Owner changed to @robpike.