aboutsummaryrefslogtreecommitdiff
path: root/src/fmt
diff options
context:
space:
mode:
authorDaniel Martí <mvdan@mvdan.cc>2018-10-03 21:01:14 +0100
committerBrad Fitzpatrick <bradfitz@golang.org>2018-10-03 20:13:35 +0000
commit112f28defcbd8f48de83f4502093ac97149b4da6 (patch)
treedc91268f72f65c2ba28e95501a85156a1834f4e1 /src/fmt
parentc91ce3cc7b13fce23edae94818e505f126036bdb (diff)
downloadgo-112f28defcbd8f48de83f4502093ac97149b4da6.tar.gz
go-112f28defcbd8f48de83f4502093ac97149b4da6.zip
io: export StringWriter
And start using it elsewhere in the standard library, removing the copies in the process. While at it, rewrite the io.WriteString godoc to be more clear, since it can now make reference to the defined interface. Fixes #27946. Change-Id: Id5ba223c09c19e5fb49815bd3b1bd3254fc786f3 Reviewed-on: https://go-review.googlesource.com/c/139457 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/fmt')
-rw-r--r--src/fmt/fmt_test.go7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/fmt/fmt_test.go b/src/fmt/fmt_test.go
index 9581becd32..d63271a805 100644
--- a/src/fmt/fmt_test.go
+++ b/src/fmt/fmt_test.go
@@ -131,15 +131,10 @@ func (byteFormatter) Format(f State, _ rune) {
var byteFormatterSlice = []byteFormatter{'h', 'e', 'l', 'l', 'o'}
-// Copy of io.stringWriter interface used by writeStringFormatter for type assertion.
-type stringWriter interface {
- WriteString(s string) (n int, err error)
-}
-
type writeStringFormatter string
func (sf writeStringFormatter) Format(f State, c rune) {
- if sw, ok := f.(stringWriter); ok {
+ if sw, ok := f.(io.StringWriter); ok {
sw.WriteString("***" + string(sf) + "***")
}
}