From: Rob Pike Date: Wed, 17 Jan 2024 00:19:53 +0000 (+1100) Subject: fmt: clear width and precision when recovering formatting object from the pool X-Git-Tag: go1.23rc1~1242 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=718dc025e7b2cdef26c6a5f3d5c2645885ef44a5;p=gostls13.git fmt: clear width and precision when recovering formatting object from the pool Probably a day 1 oversight, and almost always inconsequential, but there is evidence of occasional trouble. There is no reason not to clear them. I tried and failed to write a test to catch this, but the change should be harmless and is all but certain to fix the problem. Fixes #61913 Change-Id: I0f7bbb4ab2780d8999d3ff7a35255dc07fb5c7e1 Reviewed-on: https://go-review.googlesource.com/c/go/+/556215 Run-TryBot: Rob Pike TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor Reviewed-by: Than McIntosh --- diff --git a/src/fmt/format.go b/src/fmt/format.go index 617f78f15e..b497ad0f1b 100644 --- a/src/fmt/format.go +++ b/src/fmt/format.go @@ -53,6 +53,8 @@ type fmt struct { func (f *fmt) clearflags() { f.fmtFlags = fmtFlags{} + f.wid = 0 + f.prec = 0 } func (f *fmt) init(buf *buffer) {