fmt: correct documentation for Formatter

Before this CL, the documentation for Formatter suggested that
implementers of Format(f State, verb rune) could use Fprint(f) or
Sprint(f) to generate output. The Sprint(f) suggestion however is
invalid.

Fix that by simply suggesting Sprint() alongside Fprint(f).

Fixes #60358

Change-Id: I024e996f6360b812968ef2cd5073cb4c223459e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/497379
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Paul Jolly <paul@myitcv.org.uk>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Paul Jolly 2023-05-24 05:51:09 +01:00 committed by Paul Jolly
parent 5de20f0f34
commit 2a8969cb36
1 changed files with 1 additions and 1 deletions

View File

@ -50,7 +50,7 @@ type State interface {
// Formatter is implemented by any value that has a Format method.
// The implementation controls how State and rune are interpreted,
// and may call Sprint(f) or Fprint(f) etc. to generate its output.
// and may call Sprint() or Fprint(f) etc. to generate its output.
type Formatter interface {
Format(f State, verb rune)
}