1
0
mirror of https://github.com/golang/go synced 2024-11-22 22:20:03 -07:00

fmt: split package documentation into more sections

The package-level documentation on fmt previously had only two formal
sections, for printing and scanning. Because of this, the section on
printing was very long, including some pseudo-sections describing
particular features. This feature makes those pseudo-sections into
proper sections, both to improve readability and so that those sections
have hyperlinks on documentation sites.

Fixes #46522

Change-Id: I38b7bc3447610faca446051da235edcbbd063f61
Reviewed-on: https://go-review.googlesource.com/c/go/+/324349
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
This commit is contained in:
Branden J Brown 2021-06-02 14:55:34 -04:00 committed by Dmitri Shuralyov
parent e3176bbc3e
commit 7406180012

View File

@ -189,7 +189,7 @@
When printing a struct, fmt cannot and therefore does not invoke When printing a struct, fmt cannot and therefore does not invoke
formatting methods such as Error or String on unexported fields. formatting methods such as Error or String on unexported fields.
Explicit argument indexes: Explicit argument indexes
In Printf, Sprintf, and Fprintf, the default behavior is for each In Printf, Sprintf, and Fprintf, the default behavior is for each
formatting verb to format successive arguments passed in the call. formatting verb to format successive arguments passed in the call.
@ -211,7 +211,7 @@
fmt.Sprintf("%d %d %#[1]x %#x", 16, 17) fmt.Sprintf("%d %d %#[1]x %#x", 16, 17)
will yield "16 17 0x10 0x11". will yield "16 17 0x10 0x11".
Format errors: Format errors
If an invalid argument is given for a verb, such as providing If an invalid argument is given for a verb, such as providing
a string to %d, the generated string will contain a a string to %d, the generated string will contain a