1
0
mirror of https://github.com/golang/go synced 2024-11-06 07:26:10 -07:00
go/src/fmt
Rob Pike 668041ef66 fmt: add Append, Appendln, Appendf
These are straightforward variants of the existing Sprintf etc.,
but append the resulting bytes to a provided buffer rather than
returning a string.

Internally, there is potentially some allocation because the package
uses a pool of buffers to build its output. We make no attempt to
override that, so the result is first printed into the pool and
then copied to the output. Since it is a managed pool, asymptotically
there should be no extra allocation.

Fixes #47579

RELNOTE=yes

Change-Id: Icef797f9b6f0c84d03e7035d95c06cdb819e2649
Reviewed-on: https://go-review.googlesource.com/c/go/+/406177
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-05-17 18:55:46 +00:00
..
doc.go all: gofmt main repo 2022-04-11 16:34:30 +00:00
errors_test.go
errors.go
example_test.go
export_test.go
fmt_test.go fmt: add Append, Appendln, Appendf 2022-05-17 18:55:46 +00:00
format.go
gostringer_example_test.go
print.go fmt: add Append, Appendln, Appendf 2022-05-17 18:55:46 +00:00
scan_test.go
scan.go
stringer_example_test.go
stringer_test.go