Other flags is fixed in Go 1.19: https://pkg.go.dev/fmt@go1.19beta1
Peter
On Tuesday, July 5, 2022 at 5:47:55 PM UTC-4 ben...@gmail.com wrote:
> At the default URL https://pkg.go.dev/fmt the same thing happens for me
> too. However, at https://pkg.go.dev/fmt@master it formats correctly
> (pre-formatted block like in the source). So I assume this has been fixed
> and the default will be updated soon (when 1.19 comes out?).
>
> -Ben
>
> On Tuesday, July 5, 2022 at 12:28:33 PM UTC+12 aetr...@gmail.com wrote:
>
>> The documentation of the formatting language
>> inhttps://cs.opensource.google/go/go/+/master:src/fmt/doc.go;l=132 doesn't
>> render the "other flags" section well. It all runs together:
>> source:
>> Other flags:
>>'+'always print a sign for numeric values;
>>guarantee ASCII-only output for %q (%+q)
>>'-'pad with spaces on the right rather than the left (left-justify
>> the field)
>>'#'alternate format: add leading 0b for binary (%#b), 0 for octal
>> (%#o),
>>0x or 0X for hex (%#x or %#X); suppress 0x for %p (%#p);
>>for %q, print a raw (backquoted) string if strconv.CanBackquote
>>returns true;
>>always print a decimal point for %e, %E, %f, %F, %g and %G;
>>do not remove trailing zeros for %g and %G;
>>write e.g. U+0078 'x' if the character is printable for %U (%#U).
>>' '(space) leave a space for elided sign in numbers (% d);
>>put spaces between bytes printing strings or slices in hex (% x, %
>> X)
>>'0'pad with leading zeros rather than spaces;
>>for numbers, this moves the padding after the sign;
>>ignored for strings, byte slices and byte arrays
>>
>> rendered-
>> Other flags:
>>
>>- always print a sign for numeric values; guarantee ASCII-only output
>>for %q (%+q)
>>- pad with spaces on the right rather than the left (left-justify the
>>field) # alternate format: add leading 0b for binary (%#b), 0 for octal
>>(%#o), 0x or 0X for hex (%#x or %#X); suppress 0x for %p (%#p); for %q,
>>print a raw (backquoted) string if strconv.CanBackquote returns true;
>>always print a decimal point for %e, %E, %f, %F, %g and %G; do not remove
>>trailing zeros for %g and %G; write e.g. U+0078 'x' if the character is
>>printable for %U (%#U). ' ' (space) leave a space for elided sign in
>>numbers (% d); put spaces between bytes printing strings or slices in hex
>>(% x, % X) 0 pad with leading zeros rather than spaces; for numbers, this
>>moves the padding after the sign
>>
>> -
>>
>> Maybe there's already an issue open for this: it's hard to query for
>> src/fmt/doc.go: the terms are too common.
>>
>> -- Allen
>>
>
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/eafceaaf-ea3f-44f6-8bc9-3c079d6778e6n%40googlegroups.com.