mirror of
https://github.com/golang/go.git
synced 2026-06-27 19:30:52 +00:00
fmt: give advice on wrapper functions
Fixes #79332 Change-Id: If50e12834bf1aeaa21bd193acaba28d13f2278fc Reviewed-on: https://go-review.googlesource.com/c/go/+/777780 Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
1bcea1df64
commit
e4283592e5
1 changed files with 10 additions and 0 deletions
|
|
@ -299,6 +299,16 @@ occurred. If the panic is caused by a nil receiver to an Error,
|
|||
String, or GoString method, however, the output is the undecorated
|
||||
string, "<nil>".
|
||||
|
||||
Many packages whose APIs involve string formatting expose a trio of
|
||||
functions similar to [Print], [Printf], and [Println].
|
||||
For example, the [log.Print], [log.Printf] and [log.Println] functions
|
||||
forward their arguments to the corresponding functions in this package.
|
||||
To avoid confusion, other wrapper functions should follow the naming
|
||||
and behavioral conventions established by this package.
|
||||
In particular, a single function should not choose between literal
|
||||
printing (like [Print]) and formatted printing (like [Printf])
|
||||
based on the number of arguments; instead, provide separate functions.
|
||||
|
||||
# Scanning
|
||||
|
||||
An analogous set of functions scans formatted text to yield
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue