]> Cypherpunks repositories - gostls13.git/commitdiff
fmt: correct documentation for Formatter
authorPaul Jolly <paul@myitcv.io>
Wed, 24 May 2023 04:51:09 +0000 (05:51 +0100)
committerPaul Jolly <paul@myitcv.org.uk>
Wed, 24 May 2023 18:58:06 +0000 (18:58 +0000)
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>
src/fmt/print.go

index b3dd43ce04eeb11c83c35d3e395c006d14e42da8..9c3bd3efec9033b5a2ed31827a6101685ccd63d1 100644 (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)
 }