]> Cypherpunks repositories - gostls13.git/commit
fmt: rely on utf8.AppendRune
authorJoe Tsai <joetsai@digital-static.net>
Thu, 16 Jun 2022 00:29:25 +0000 (17:29 -0700)
committerGopher Robot <gobot@golang.org>
Wed, 21 Sep 2022 13:54:31 +0000 (13:54 +0000)
commit9c916c79011f3af98b5670eb2ba55349ba904522
treea48661057fe10005e6cf0ffbfdba1bf733ab7ee1
parentd11c58eedbee29b4912dd50508b36ad15ebb739e
fmt: rely on utf8.AppendRune

This is both simpler and more performant.
The need for fmt.fmtC to manually check for utf8.MaxRune
is subtle to avoid overflow when converting uint64 to rune,
so a test case was added to exercise this edge case.

Change-Id: I0f2e6cce91dcd4cc6b88190c29807ca1c58e999d
Reviewed-on: https://go-review.googlesource.com/c/go/+/412335
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
src/fmt/fmt_test.go
src/fmt/format.go
src/fmt/print.go